So basically I am trying to make an action start a timer and make it so another element cant be clicked until that timer runs out… here is an example
So there is a Button Called “Suspend” when clicked I want it to start a countdown of 2 hours and then make it so the “Un Suspend” button can be clicked after the 2 hours the “Un Suspend” button can be clicked and used as normal
Add field somewhere in your db for the suspended status, yes/no. default=no
In your wf, add actions
change suspended status=yes
add pause before next action, 2 hours (in ms)
change suspended status=no
Add in your other elements contains event: when susp status=yes, isn’clickable/disable etc
(to make it faster your can create cust state for this susp status on the page for this susp status, its state yes/no shall be set on your wf and when page loaded)
@anwarsby you’re on the right track with the data, but unfortunately the “add a pause before next action” does not pause non-display workflows. Changing the database will happen almost instantly.
You can do what @anwarsby suggested but with a “schedule workflow action”. Unfortunately, that happens client-side, so if your user’s browser is closed or the connection is interrupted at any time in the 2 hours, it will not reset to no and will stay suspended indefinitely.
You can do date subtraction, unfortunately again, the current date/time does not automatically refresh client-side. So as long as your user doesn’t refresh the page, the button stays locked.
So you have two options:
If you’re on any paid plan, you can Schedule an API workflow to reset the state to “no” with the correct date. That happens server-side so it will work regardless of whether or not your user closes or refreshes the browser.
If you’re on a hobby plan, you can add a band-aid with a “do every x seconds” workflow that updates the current date time to a state, and use that state to do the date substraction. This will work but is heavy.
Here is an editor showing the four free functions. Schedule api workflow is only available on paid plans.