Ok, so I am trying to use the afterSave
function to change some values in a separate table. In my setup, the object that changes in the first table has knowledge of a unique field in the second. I feel like the process should go: afterSave
-> call get of specific column -> use that to query the second table -> set a field of the found object. When I try this, nothing changes. I'd really appreciate any help. Thank you!
Parse.Cloud.afterSave("A", function(request){
var A_obj = request.object
if (A_obj.get("TriggerColumn") == "TriggerValue") {
var B = Parse.Object.extend("B")
var query = new Parse.Query(B)
query.equalTo("B_Data", A_obj.get("Known_B_Data"))
query.find({
success: function(b_array) {
var b = b_array[0]
b.set("B_Other_Data","New Data")
b.save()
}
})
}
})