I am trying to retrieve/fetch a current object from the beforeSave
method as I want to know the value of "Parent" column before update was initiated.
I used the below code. However, I see that older values and newer values remain equal though value of "Parent" has been changed through data browser.
Is there any suggestion to read the current object from beforeSave
? Is anything going wrong below?
Parse.Cloud.beforeSave("Products", function(request, response) {
var oldObject = new Parse.Object('Products');
oldObject.id = "RTRzAf1FyX"; // RTRzAf1FyX is equal to request.object.id. oldObject.id is being hard coded to RTRzAf1FyX
listOfAllPromisesForCurrentObject.push(oldObject.fetch());
Parse.Promise.when(listOfAllPromisesForCurrentObject).then(function(currentObject) {
console.log("11111 +++++++++++++++" + JSON.stringify( request.object.get('Parent')) ); //Parent is a column name
console.log("11111 ---------------" + JSON.stringify( currentObject.get('Parent')) );
});