Hi everyone,
I’ve run into a classic client-server sync edge case, and I’d love to hear how you all prefer to handle this in your apps.
The setup
I have a Grouped Action designed to generate a serial number (which is sequential) and an alias for a record. It consists of:
-
Generate Serial No
-
Use Serial No (update
Serial NoasAlias)
I specifically do not use Initial Value for this because calculating sequential serial numbers client-side introduces a massive risk of duplicate serial numbers due to concurrency. Relying on server-side execution is far better for mitigating duplicate sequential numbers (even though it isn’t 100% bulletproof).
Because of this, I trigger the action in two ways:
-
Bottrigger (Adds - Primary): An automation that runs on saving a form when a new record is created. This forces the sequential generation to happen on the server. -
Manual trigger (Updates - Fallback): An action button on the record. This is strictly a fallback for edge cases to allow assigning a serial number manually if one is missing or if a duplicate somehow slipped through.
My current sync & feature configurations:
-
Performance: Sync on start: ON | Delayed sync: OFF | Automatic updates: ON
-
Features: Pull to refresh: ON | Preview new features: ON | New mobile framework (preview): ON | Desktop design: ON
The issue
When the fallback manual trigger is used, it works perfectly. It executes client-side, the local cache updates instantly, and the completed record syncs to the server.
However, when the Bot triggers on creation of a new record, I am hitting a race condition if the user edits the record while the background sync is still in progress.
Here’s the exact flow of the issue:
-
The user creates a new record and submits the form (
Serial NoandAliasare initially blank). -
The server receives the row and triggers the
Bot. TheBotsuccessfully generates the sequential serial number and alias, updating the database. (I verified this by checking the “Automation Monitor” logs—the inputs and outputs are perfect!) -
The edge case: Before the background sync finishes pulling the
Bot’snewly generated data down to the user’s device, the user makes a quick edit. -
Because the user’s local device hasn’t received the server update yet, their local cache still has a blank
Serial NoandAlias. -
The user saves their edit. The app pushes this locally cached row to the server, completely overwrites the server-side generated sequential
Serial NoandAliasin the database.
Observations on the sync UI
Interestingly, I noticed that if I disable “New mobile framework (preview)” and “Desktop design”, AppSheet occasionally provides a dedicated sync page UI that restricts user modifications during the sync. However, this blocking UI only appears for automatic 30-minute interval syncs or manual user-triggered syncs—not for record-level background syncs after a form save.
A feature request for the team
This highlights a great use case for a universal sync configuration. If enabled, would consistently lock the app state across all types of syncs (background form saves, automatic interval updates, and manual syncs). Having this seamless ‘lock state’ during any active sync would completely eliminate this race condition.
My Question
I am looking for some architectural workarounds to prevent this overwrite without compromising the server-side logic.
Would appreciate any insights or best practices!