AfterSave trigger- Trigger only after first save?

I use aftersave triggers but İt runs everytime I update object. But I want it to trigger only for first save. How to do that?

You can do something like this:

Parse.Cloud.afterSave('MyClass', req => {
  if (req.original) {
    console.log('it is an existing object');
  } else {
    console.log('it is a new object');
1 Like

it works thank you…

Hi. @davimacedo Does this also works for beforeSave trigger?

In the beforeSave trigger you can use request.object.isNew() to check if it is a new object.

1 Like