0

I am having some trouble making a Parse Cloud function work. I hope someone can bring me some help. I started by following some other function I had written before. But it has been a while; and it seems like things have changed. The text of the function (below) is self explanatory of what I want to do, but the syntax must be wrong because it is not working and I get various errors or deprecation warnings. Here is the code:

Parse.Cloud.define
("removeRecord", function(request, response) {
  var objectQuery;
  objectQuery = new Parse.Query("Record_List");
  objectQuery.equalTo("objectId", request.params.unitID);
  objectQuery.equalTo("ownerID", request.params.userID);

  objectQuery.find().then
  (function(resUnit) {
    // If nothing has been found we return an error.
    if (!resUnit.length) response.error("NOT-FOUND");
    else {
      // We set the status field to "DELETED" on the record found.
      resUnit.set("status", "DELETED");
      response.success();
    }
  });
});
Michel
  • 10,303
  • 17
  • 82
  • 179
  • Can you attach the errors/warning you get? What version of Parse Server your are using? – L3K0V Feb 25 '20 at 21:30
  • 1
    I was appearently using some old syntax. After I rewrote the function following this guide, it worked: https://docs.parseplatform.org/cloudcode/guide/. Thank you. – Michel Feb 27 '20 at 14:28

0 Answers0