Is the aftersave function in the cloud code called every-time an object of a specific class is updated or is it called only after an object of the class is created ?
2
votes
1 Answers
5
votes
The afterSave cloud function is called every time an object of that class is created or updated. (persisted) in the database.
However, if you want it to tigger only when the object is created, you should do as follow:
Parse.Cloud.afterSave('your_class_name', (request) => {
if (!request.original) {
// this means the object is just created
} else {
// this means it is an update to the object.
}
});