Search code examples
parse-platformparse-cloud-code

Parse CloudCode beforeSave object does not have objectID


I am trying to send a push to a user from Parse Cloud Code every time a new object is created of a certain class, but in the push i need to send the objectId to the user, but it is always null. So is the objectId available in beforeSave when a new object is created?


Solution

  • No, the objectId is not available until after the object is saved. However, there is an afterSave() method where you can send the push. Works the same way as beforeSave().