Is there a way to wait until method is completed?

Hi everyone!

After checking with our developers, I can confirm that using a custom sleep / setTimeout function is supported. That said, please remember that script actions have a maximum runtime of 60 seconds. This limit is in place for security reasons – for example, to protect against mistakes such as infinite loops.

If your workflow requires more time, consider breaking down a complex rule into smaller rules that trigger each other. This can help separate your logic into multiple steps and avoid hitting the 60-second timeout.

Here’s an example of a simple sleep function shared by our developers:

const sleep = async (ms) => {
    log('Waiting...');
    const start = Date.now()
    let currentTime = Date.now()
    while(currentTime - start < ms){
        currentTime = Date.now()
    }
};
6 Likes