JavaScript Parse JavaScript SDK and Promise Chaining parse js promise,javascript parse promise,parse node js promise,

I have created a Background Job in Parse Cloud Code that sends out email notifications based on a date in one of my Parse classes.

Here is the idea: Query the class that contains the date. Iterate over each object returned and check the date field. If the date is equal to today, send out an email notification, change the date to null and save it back to Parse.

However, it seems that not all the objects are saved back to Parse. I suspect this an issue with my promise chains, but I am having a hard time diagnosing the exact issue or how to fix it. Below is relevant code

Parse.Cloud.job("job", function(request, status) {


// Query for all users
var query = new Parse.Query(className);
query.each(function(object) {

    if (condition) {

        object.set(key, false);
        object.save(null, {
            success:function(object){
                // This never executes!
            },
            error: function(error){

            }

        }).then(function(){
            // This never executes
            console.log("Save objects successful");
        },
        function(error){
            status.error("Uh oh, something went wrong saving object");
        });

        // Set hiatus end successful
        Mailgun.sendEmail({
        });
    }

    });
});

This line console.log("Save objects successful"); in the objects.save() promise chain does not ever get executed - even when the subscription object is successfully saved to Parse.

Additionally, if there are more than 5 objects returned by the query, only the first 5 are successfully saved back to Parse. Any additional saves are not executed and email notifications are not sent.

Answer:1

I am using a jQuery plugin which converts a normal select dropdown into a fancy multi select dropdown. Here's the plugin url: http://wenzhixin.net.cn/p/multiple-select/ Now, the problem which i am ...

I am using a jQuery plugin which converts a normal select dropdown into a fancy multi select dropdown. Here's the plugin url: http://wenzhixin.net.cn/p/multiple-select/ Now, the problem which i am ...

  1. angular with jquery example
  2. angular with jquery datatable
  3. angular with jquery
  4. angular with jquery plugins
  5. angular with jquery ui
  6. angular with jquery datepicker
  7. angular with jquery mobile
  8. angular with jquery autocomplete
  9. angular 7 with jquery
  10. angular 6 with jquery
  11. angular 4 with jquery
  12. angular 8 with jquery
  13. using angular with jquery
  14. angularjs jquery
  15. angular 2 with jquery
  16. angular 5 with jquery
  17. angular conflict with jquery
  18. angular bootstrap with jquery
  19. integrate angular with jquery
  20. mix angular with jquery

I've been playing around with HTML5 and Javascript a lot lately and have been really impressed with the functionality of LocalStorage as well as SessionStorage. It got me to thinking - with the advent ...

I've been playing around with HTML5 and Javascript a lot lately and have been really impressed with the functionality of LocalStorage as well as SessionStorage. It got me to thinking - with the advent ...

I've created a 3D cube, that rotates clockwise and anti-clockwise on the Y-axis when the left and right keys are pressed, and then rotates on the X-axis when the up key is pressed. My issue is, that ...

I've created a 3D cube, that rotates clockwise and anti-clockwise on the Y-axis when the left and right keys are pressed, and then rotates on the X-axis when the up key is pressed. My issue is, that ...

i was curious if it's possible to inject an value into a directives' close scope. I could't find anything related in the angularjs documentation so I tried something. Does anybody know if there is an ...

i was curious if it's possible to inject an value into a directives' close scope. I could't find anything related in the angularjs documentation so I tried something. Does anybody know if there is an ...