Reputation: 1002
Im trying to run this cloud code every time a new object gets saved to my class called "Message", however i believe i am calling the afterSave method incorrectly because not even my console.log is showing up after i save a new object to my class called "Message". What is wrong with my code?
Parse.Cloud.afterSave("sendMessage", function(Message, response) {
var messageBody = null;
var messageSenderName = null;
var messageSenderId = null;
var randUsers = [];
console.log("The variables were set");
............other code that doesn't matter................
});
Upvotes: 0
Views: 810
Reputation: 1836
As far as I see, you want to fire up a cloud function whenever new entry is saved to Parse DB. For this scenario afterSave is the way to go. However, your function declaration is wrong. The function must be in the format;
Parse.Cloud.afterSave("Message", function(request) {
.....
}
where the request contains the currently saved entry information.Hope this helps.Regards.
Upvotes: 2