简体   繁体   中英

Javascript - Parse - Cloud Code - beforeSave and afterSave

Does beforeSave and afterSave run when files are edited by the administrator in the data browser? Or only when a file is created and saved within an app? Reason I'm wondering is because when I'm changing some column information within an already saved object, I'm getting the error message: "Error: success/error was not called". It would be extremely undesirable for the beforeSave and afterSave methods to run when objects are simply being edited after the fact by an administrator, so I really hope this is not the case.

Thanks if anyone has input.

Cheers.

Yes, the beforeSave and afterSave triggers are called both when the object is created and when it's modified. Take look at the existed() function.

if(!request.object.existed())
     //is a first-save

} else {
    //just an update

}

Here the official reference .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM