Skip to main content

WAIT

Some business processes need to be executed over a long period and wait between execution of specific Steps. The Wait Step exists exactly for this purpose -- it enables Process Authors to pause execution until a certain timestamp.

Wait time can sometimes involve business logic, which is why the Step is configured using JavaScript code. When execution of the Wait Step begins, the code is interpreted, and its result is used to determine the wait duration. The result must include a field named waitUntil and hold the value of the epoch timestamp for when execution should continue.

Video Overview: Wait Tasks

Sample Implementation

To wait for 3 seconds after the Step has started, use the following snippet:

(steps, context) => {
const startTimestamp = steps.__self.start;
// Add 3000 millisonds to the start time
const waitUntil = startTimestamp + 3000;

return {
"waitUntil" : waitUntil,
}
}

Input

FieldDescriptionMandatoryJSON Example
scriptThe JavaScript code to run to determine resume time.See example above.

Output

FieldDescription
resultThe returned object from the input.script.
logsAny logs emitte during the execution of the input.script.
errorAn error message if there was an issue waiting.