Skip to content

Introducing Background Jobs

Today we're excited to introduce Background Jobs. We've listened to your feedback and this was one of the most requested features. Background Jobs allow you to set up long running tasks by writing code similar to Cloud Functions:

Parse.Cloud.job("userMigration", function(request, status) {
  // Set up to modify user data
  // Query for all users
  var query = new Parse.Query(Parse.User);
  query.each(function(user) {
      // Set and save the change
      user.set("plan", request.params.plan);
  }).then(function() {
    // Set the job's success status
    status.success("Migration completed successfully.");
  }, function(error) {
    // Set the job's error status
    status.error("Uh oh, something went wrong.");
In the above code example, a user migration Background Job has been defined to update a plan field in the Parse.User object. This is a good candidate for a Background Job as it could be a long running process that could timeout if set up as a Cloud Function.

Once you've deployed your code, you can add it as a new entry to the jobs schedule in the Web Console. There are many options available to customize the frequency of your jobs, including the start time. You can also view the status of any currently running jobs or previous jobs that have been completed.

screenshot of UI for managing your background jobs

For more information about Background Jobs, check out the Cloud Code Guide.