Hi,
I have a question regarding how API workflows (recursive or on a list ; I guess it won’t change the answer for this question, but if it does, please let me know) are affected by other database changes.
Let’s say I have a frontend workflow that schedules an Api workflow that modifies the name of each user from a list of 100 users.
And the next step of my frontend workflow is to delete these 100 users, what will happen for the backend workflow?
From my understanding, backend workflows are run asynchronously, so I m afraid the list will be deleted before the backend workflow actually runs the necessary action on all users.
If that concern is confirmed, what should be the approach to ensure the data within the backend workflow will remain? Use a “make static”?
Many thanks for your help!
If you’re scheduling the previous workflow on a list, then after the front-end workflow deletes them you’ll be making changes to an empty thing (as the User no longer exists).
Send the relevant info as text parameters.
Let’s suppose I schedule a backend workflow to run in 5 minutes that takes a User and sends them an email based on their name.
Schedule API workflow to run in 5 minutes that takes User and sends email with content User’s fullName
After scheduling API workflow, I make changes to the User’s fullName
When the scheduled API workflow runs, it looks up the User and gets its fullName, which is different from when we scheduled it.
Sending a User as a backend workflow parameter is just sending the unique ID of the User in the database, and we look up the User’s fields when the workflow is run.
Now, suppose:
Schedule API workflow to run in 5 minutes that takes User parameter and a fullName text parameter
We change the fullName in the front-end before the scheduled API workflow runs.
When the workflow runs, fullName will be the same as when we sent the parameter, but User’s fullName will be the updated version (as that lookup happens when the workflow is run.
Thanks @georgecollier, great explanation.
I will validate it.
But just to be sure here, what about the behaviour when it’s scheduled “current date/time”.
Because in the example with 5mn, we will have the second step that runs within the five minute delay, updating the user’s full name even before the api workflow truly executes.
But if I select “current date/time” then it should execute before the next step right?
Sending a User as a backend workflow parameter is just sending the unique ID of the User in the database, and we look up the User’s fields when the workflow is run.
Perfect info, ok if that’s the case, then this fully answers my question, and even for the case with “current date/time”!
Send the relevant info as text parameters.
Would “make static” work or only “format as text” would do the trick?
Scheduled current date time will generally start running in one second. It will almost definitely execute after any subsequent front-end actions.
No, make static only applies to Lists / repeating groups.
Yep, in my case it’s a list I’m working on.
Thanks very much for your prompt and clear explanations!!