Posts

Showing posts from February, 2014

Parse | Identify Changed Columns

Sometime it is important to identify if the value of the column is changed and perform a action based on it. In the parse we have an method called request.object.dirty(<column_name>) . But the only issue is that this works only on the beforeSave. But most of us want to perform an action only when we are sure that data is saved. In other word we would like to do it on "afterSave". for eg. If you want to send a email or push notification based on a status flag getting updated. We would like to do that on the "afterSave". But on "afterSave" Here is the code how to do it. Parse.Cloud.beforeSave(" ", function(request, response) { //--find the columns which got changed var arrChangedAttributes = new Array(); var vAttributes = request.object.attributes; var query = new Parse.Query(" >> id >>>" + request.object.id ); //--means it is an INSERT. This is to identify it is an INSERT or UPDATE if(!req