Created
May 2, 2017 02:06
-
-
Save kishanio/05dff7c692ac2c9e38d5b99d9390b150 to your computer and use it in GitHub Desktop.
Parse Cloud Code afterSave trigger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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