I need to check (and take appropriate action) if an object is just being created, or an already-existing object is being updated with new values. Is there any way to check this accurately?
Asked
Active
Viewed 1,486 times
1 Answers
11
Yes there is. A new object will not have an id yet, so you can check the object if it has an id.
Parse.Cloud.beforeSave("MyClass", function (request, response) {
var object = request.object;
if (!object.id) {
// this is a new object
}
});

Tom Erik Støwer
- 1,399
- 9
- 19
-
2There's also the `isNew()` instance method. – Alessandro Vendruscolo Jan 08 '16 at 11:26