How to wait or sleep for a few seconds in Flow

It appeared that two REST API calls in immediate succession fail in the second call: after a POST to create some object (201), a GET some info about the same object (404 instead of 200).
When a User Step is inserted between the steps and the user waits a few seconds, the second step succeeds (200) !
Now the question is how to make a step that waits or sleeps a defined number of seconds before continuing the flow.

Hi,

There is a sleep function you can run in an assignment step between the requests. The below is from the Flow Connect help but the sleep function exists in Classic as well. Not sure why it’s not documented there :slight_smile:

Signature: sleep(minMilliseconds: number, maxMilliseconds: number) β†’ number

Pauses script execution for a randomly chosen number of milliseconds between minMillisecondsand maxMilliseconds.

sleep(10000, 10000) // will return 10000 and pause the execution for 1 sec

I suppose that 10000 wll pause for 10 seconds.
I applied this assignment but the flow did not pause and the GET failed:

Me stupid. This version is actually sleeping for 3 seconds:

1 Like

Great, hope it solved your issue :slight_smile: