Programme Step - Wait and Wait Until

There are many reasons to wait in a programme. For example, if a programme sends multiple emails, and it needs to wait for a user's response (or lack thereof) before sending the next email/ or other outbound interaction.

We have created three different types of wait step, each one having a multitude of options to choose from, allowing the programme to wait until various time windows have elapsed or events have been performed.

If you do not wish a user to re-enter a programme for a set amount of time after its completion, you can disable concurrent runs and add a plain wait step to the end of the programme.

Wait

The primary, and most simple wait step is simply called wait.

It allows the platform to wait for a pre-specified time period, based on the time that the step was first reached.

Wait Until

The Wait Until step is a more advanced type of wait as it allows an exact time/date to be specified that the programme should wait for before executing its next command.

There are two ways to specify for how long the programme should wait.

Setting a date in the future

You can choose a day of the week, and a time of day for the wait to end, e.g. wait until the next Monday at 3pm.

Using a function to calculate a date to wait until

When using this function, if the step prior has not completed by the specified date then the wait step will pause the programme until the same day and time the following week.

If you need an email to go out at a specific time of day on a specific  DATE, it is important to explicity define the time it should be sent (using a Javascript style step)

In this type of step you need to perform a javascript function in order to return a millisecond accurate timestamp. The system will frequently re-check this step to see if that time has passed. If it has then the system will proceed, otherwise it will check that step again. For more guidance on javascript functions, please see the core programme documents.

Because of how the system re-checks for a time in the past, you can encounter issues if you have opted for the Javascript function option and you have made this wait step rely on the current time. This is because as the time is re-evaluated it can increase the wait 'timestamp' every time the step is evaluated and checked. For example, if you are always adding 5 minutes to the current time in your JS and returning that value, each time our system runs your JS to check the time, it will always be 5 minutes ahead, and never in the past, so the programme will proceed past that step. In order to mitigate this, we provide some information in the programmeData with a timestamp of when the step was started, which you can use a reference point instead of current time, see the example below.

Module Data can be passed to the function. (To learn more about Module Data, see Programme Modules).

function(programmeData, moduleData) {
	return moment(programmeData.__programmeContext.stepStartedAt).add(5, 'minutes').valueOf();
}

An example of a Wait Until (following the JS) can be seen below:

Still need help? Contact Us Contact Us