0
votes

I have some questions regarding Cloud Code (Couldn't find details in the docs).

  1. Can triggers (afterSave...) trigger other triggers ? Example: afterSave("Post"...) creates a new row in Comments where there's also an afterSave function attached.

  2. Is there an afterInsert event ? Or do we need to use beforeSave and check if objectId is null ? Or is there another way to check such thing ? (I need to trigger certain function only after insert, not modification)

Thanks

1

1 Answers

0
votes
  1. The triggers will fire regardless of the source of the change. So afterSave would fire for a row created in another afterSave handler.

  2. There isn't an afterInsert; only a afterSave. You can't check if objectId === null in afterSave because it would always be false (it was just saved, after all). You can use Parse.Object.isNew to check if it is new. I believe it still returns true in afterSave for a new object.