Actions in workflow running out of order

Each User has a list of Things. When the user clicks a button, it should delete the first item from the list, and then display the first item from that list (which would be the second item from the list before the workflow ran). Here is the workflow:

Deleting the first item:
Displaying the new first item:

What instead happens is that it displays the first item from the list, and then deletes the first item from the list.

How can I make sure that the deletion action happens first and then the display action happens?

As actions in workflow are asynchronous (they can be executed at the same time), the best method to be assured not running ‘out of order’ is simply used a condition Only when in Display data saying ‘if action 1 isn’t empty’.

1 Like

Thanks for the response! I added the Only when condition, but the issue is still happening.

Further, I’ve tried it in the debugger, and when I run step-by-step, it runs in order, but when I just run it, the display action happens first.

The “make changes” step is happening on the server, and the display data step is happening on the client.

There is some internal logic that checks if the client code needs to wait for the server code to finish, unfortunately this is one of the situations where it doesn’t notice the dependency.

You can work around it by setting the value “current user’s display product list # item 2” to either a custom state or a group, before running the make changes step.

Or you can see if the dependency can be put in, by modifying a simple field like a number, and writing that number to a client element afterwards.

1 Like

Can you elaborate @mishav on that matter as I expect dependency to work on any cases. (surprised to see otherwise). So to resolved that particular action out of order it will be ‘faking’ value in a state first and then referred to it? This case can be sent to Bubble for investigation or it is simply the js logic fault?

I agree with you @JohnMark.
Im also interested in @mishav’s explanation to why this didn’t work.
When I saw your answer I thought it should have worked.

I gave it a try, and if the “make changes” step alters a text field in the database thing, the updated field is used by the “display data” step. But, if it changes a list field as well, the prior value of the list’s first item is still used on the second step.

So, looks like the dependency is not just on the workflow steps, but also in the particular dynamic expression, and a list field doesn’t do it correctly.

@joshua.hovden I suggest you raise it as a bug, and link in this discussion.

EDIT - this post by @josh explains at high level what I mean by “dependency between steps” …

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.