Synchronous Run action in Flow

So I'm battling a timing issue with a flow that loads up a half dozen data stores after retrieving from a server connect.

On start of the server connect, I clear the data stores.

On success of the sc, I run a page flow to load all the data using startBatch and endBatch for each store with a repeat in between.

The result is that ~15% of the time, the data store is empty, OR has not been cleared and thus appends to the existing data, instead of replacing it.

I have resorted to my least favorite thing, a big ugly wait command before loading everything and this seems to be working.

As I understand it, actions within a flow are synchronous, except for the Run action. In other words, I can ask a Run action to clear data stores, but I can't be confident it has completed before adding new records. I could perhaps do a While loop that waits for the number of records from the sc to match the ds, but that seems like a hack.

So this request is to consider a synchronous Run action in page flows. An action that waits for its commands to complete before moving to the next action.

And despite this being a feature request, I'd love to hear other ideas on how to solve this in the current environment!

1 Like

The issue with the datastore has been fixed, it wasn't related to app flows.

The run action in app flows behave the same as all the other actions. Most component actions are sync and should give no problems, the only exception is the load method on the serverconnect/api connector which only triggers the load but doesn't wait for it to finish.

1 Like

Hey @patrick, would it be possible to add a 'wait to complete' option for API/SC flow actions to prevent them moving on until the action is 'done'?

The problem with the serverconnect load method is that it is debounced, when 2 loads are called directly after each other the first one is never executed and will also never finish. We could wait for the first done event but we can't guarantee that it has the data you expect. If you need the data within your flow then use the serverconnect flow action instead of the app connect component.

1 Like