API: Frontend out of sync with backend?

Two tables; Jobs (parent) & StopTime (child)

StopTime has two relevant columns; [StopBegin] & [StopEnd]

In a detail view of the Jobs table I have an action button, “Add Stop” that triggers a webhook which creates a row in the StopTime table. This newly created row will have the [StopBegin] column filled with the current time. The [StopEnd] column will be blank.

At this point, an action button to “End Stop” should be visible. The condition to show this button relies on there being a related row in the StopEnd table with a blank [StopEnd] column. This will always be true if the webhook ran successfully.

My app has ‘Delayed Sync’ disabled. Any change the user makes causes the app to sync immediately. When the user clicks the ‘Add Stop’ action, the app beings to sync and the row is created in the StopTime table. When the app returns from syncing, the ‘End Stop’ button SHOULD be shown because a new row with a blank [StopEnd] column was just created. Problem is, the button is not shown. Its as if the condition for this button was not met before the app finished syncing and the view is shown.

If I re-sync the app, the condition to show the button is met and the button is shown.

I’d appreciate any help or opinions.

@LeventK @praveen @Aleksi

Solved Solved
0 15 1,386
1 ACCEPTED SOLUTION

@Michael
With the Delayed Sync, you are possibly using the Background Updates also. And as you are creating the additional row with the API, the app will first record the parent record and than create the child record. So it’s inevitable that you won’t be seeing the action button till the background sync finalizes because, as there won’t be any child records in the table yet, the conditional rule for that action button will not be met.

This is not a bug but by-nature the sequence is like this. However I might propose a workaround:

In the parent record table, create an action with Data: go to another view in the app and use this expression:

LINKTOVIEW("TheViewNameYouWantToShowAfterFormSaved") & "&at=" & (NOW() + 1)

and create a Grouped: execute a sequence of actions action together with your Add Stop action, this action being the first one to be executed. This will force a hard sync of the app, when synced you will notice the End Stop action as the child record will already be created.

View solution in original post

15 REPLIES 15
Top Labels in this Space