Struggling to differentiate between whether a PFUser is being updated or saved for the first time? I tried implementing a solution from parse.com here, but it's not working as expected. No matter what, I always end up with a false value, be it an initial creation or an update. Below is the code snippet I used.
Parse.Cloud.afterSave(Parse.User, function(request) {
Parse.Cloud.useMasterKey();
// The error log consistently displays false, regardless of sign-up or update operation.
console.error(request.object.existed());
if (!request.object.existed()) {
// This block runs when a new user signs up, yet it's not functioning correctly.
}
else {
// Supposedly for updates, however, this never executes.
}
)}
The behavior of this code is not meeting my expectations, mainly due to the request.object.existed()
continuously returning false. Could this issue stem from attempting to save a PFUser
instead of a general PFObject
? Any tips on using request.object.existed()
after saving a PFUser would be appreciated. Thanks.