Drafts Scripting Reference

Context

A single global “context” object is available to scripts to control flow of the currently running action.

It is important to understand that cancel() and fail() will not immediately stop script, just stop any further action steps from being performed.

Instance Properties

Instance Functions

Examples

// test for logical condition before continuing
if (!validationCondition) {
  context.fail();
}
// code below will still run.
// if a "Run Workflow" step preceded this script, lets look for a result
var response = context.callbackResponses[0];
if (response) {
  // Workflow returns one "result" parameter, other apps may use other values.
  var result = response["result"];
  if (result) {
    // so something with the result
  }
}