Is it possible to have the alert timer/wait async?

In my workflow I want to show an alert to the user that a process has started. I show this alert for 5 seconds. But currently the rest of the workflow is waiting for these 5000ms to be completed before it starts executing the rest of the workflow.

Is there a way to show a notification to the user for 5 seconds and in the meantime already process the other actions?

I’m sure you could make this with a custom JS formula and Copilot, or maybe even by having two workflows?

So how do you guys use alerts at the moment? Always at the end of a workflow? Or are users always waiting for the full amount the alert shows and then continuing other actions?

You can set a variable at the beginning of the workflow → show notification to true, then before the end set it to false.

Yes. But that’s not my question. I’d like to show a notification for 5 seconds. If I set a variable at the beginning, then set “wait for 5 seconds”, it won’t run any of the other actions in the meantime. Now I expected this to be like this if I use the wait in the exact workflow of the other actions. But if I use the prebuilt “alert display” component, and execute a second workflow, I was expecting the notification just to show for 5 seconds and in the meantime it would run my other actions.

If you use Window: setTimeout() method - Web APIs | MDN, you can do an asynchronous timeout, that doesn’t execute synchronously, meaning that it will just go and execute indipendently of your other actions running, as you can see with the guy who went to have a drink and finished drinking way before the notification got hidden again.

1 Like
  • have the workflow showing the alert in a global workflow, note its uuid
  • when you want to show the alert use a javascript action with this code wwLib.wwWorkflow.executeGlobal("worflow-uuid",{parameter1:"", parameter2:""}). replace the uuid and parameters accordingly
  • in the global alert workflow you can show it, use the nocode time delay action to wait and then hide it.

using executeGlobal without awaiting its Promise lets your main workflow run in parallel

4 Likes

Awesome, this works! Much appreciated!

1 Like