Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kishanio/05dff7c692ac2c9e38d5b99d9390b150 to your computer and use it in GitHub Desktop.
Save kishanio/05dff7c692ac2c9e38d5b99d9390b150 to your computer and use it in GitHub Desktop.
Parse Cloud Code afterSave trigger
Parse.Cloud.afterSave("Book", function(request, response) {
var book = request.object;
var Shelf = Parse.Object.extend("Shelf");
var query = new Parse.Query(Shelf);
query.get(book.get("shelf").id).then(function(shelf) {
shelf.increment("bookCount");
shelf.save();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment