The issue: i need to set the email value for parse user in beforeSave trigger, because it will be null in case of facebook sign up i know that it can be sent from the client side and i fixed it in the next version but for now i am trying to get the app working till apple approval
The problem: email field is unique, that's why parse couldn't set the email value in beforeSave trigger and here is the error: Result: Can't modify email in the before save trigger
Trials:
- I tried to set the email in afterSave trigger and it works but in the response the currentUser has the old value which is null
- I thought about making the field email by default not unique and i can check the uniqueness in a trigger beforeSave, but i didn't find a way to do this
My code :
Parse.Cloud.beforeSave(Parse.User, function(request, response) {
var user = request.object;
console.log("email before set = "+user.get("email"));
user.set("email", "a@b.com");
console.log("email after set = "+user.get("email"));
response.success();
});