Search code examples
parse-platformpfobjectbefore-save

Saving an object on Parse


On Parse.com when saving an object I implement Parse.Cloud.beforeSave. But along the object to save I’d like to pass some extra information which is only for checking reasons and not part of the object to save. How should I pass this kind of data? Inside request.object and then remove it before saving? (I don’t know how to do that) Any other solution? For example something like request.extraParameters that one could use.

Parse.Cloud.beforeSave
(“MyClass”, function(request, response) {
request.object…..
});

Solution

  • Personally I'd go for a cloud function:

    Parse.Cloud.define("saveStuffWithExtraParameters", function(request, response) {
        //do something with extra parameters and save object here
    });
    

    You should have both your object and the extra parameters in the request object.