DEV Community

Swati Rawat
Swati Rawat

Posted on

Building Reliable Mobile-to-ERP Integrations for Enterprise Workflows

A field-service app can appear reliable during demos and still fail the moment two people edit the same work order. A technician changes a maintenance status on a train with no signal. Meanwhile, a dispatcher updates the scheduled task at headquarters. When the phone reconnects, which value wins?

If the answer is simply “the most recent update,” the system may overwrite a legitimate decision. Offline-first enterprise mobile development needs a protocol for ownership, versioning, retries and reconciliation, not just a local database.

Start with server-owned records and versioned writes

Imagine an illustrative maintenance app. The ERP owns the official work order, while the mobile client holds a permitted local cache and a queue of proposed changes. The local database is not the enterprise system of record.

Each queued operation should contain a stable operation ID, entity ID, field-level changes, base server version, local creation time, and a device or actor reference. Avoid putting credentials or sensitive employee details into diagnostic events.

type PendingChange = {
  operationId: string;
  workOrderId: string;
  baseVersion: number;
  patch: Record<string, unknown>;
  createdAt: string;
};

// Illustrative contract; server must authorize and validate each patch.
async function submitChange(change: PendingChange) {
  return api.post('/work-orders/changes', change);
}
Enter fullscreen mode Exit fullscreen mode

The server first authenticates the request, checks permissions, and rejects stale or invalid operations. Idempotency prevents a retry from applying the same operation twice. A successful API response does not guarantee that the ERP has processed the update, so the application must define what “accepted,” “applied,” and “confirmed” mean.

Do not treat every conflict the same way

Some data can merge safely. Two technicians adding separate inspection photos might create independent append-only events. Two users assigning the same technician to incompatible jobs cannot be merged automatically. Updating a regulatory inspection result may require supervisor review rather than choosing whichever client timestamp is later.

A sensible protocol can use three outcomes: accepted, rejected with reason, or needs reconciliation. For the last case, preserve both versions and let the authorized person decide. The phone should make the conflict visible without pretending one edit never happened.

Design the retry path

Connections will fail after requests arrive but before responses return. Therefore, the client should retry using the same operation ID, with bounded backoff. The server should record that ID and return the earlier outcome on duplicate submission.

Do not rely on local timestamps to determine authoritative ordering: clocks can drift or be manipulated. Use server-side versions and a consistent data ownership policy. If the user's access has been revoked while offline, cached data must be governed by the organization's device and app protection policies, and the server must reject later unauthorized synchronization.

Test the uncomfortable cases

  1. Capture a work-order update with airplane mode enabled; confirm the app labels it as pending rather than submitted.
  2. Change the same record in the ERP; reconnect the phone and verify that the conflict is exposed.
  3. Submit the same operation ID twice; confirm it cannot cause duplicate writes.
  4. Revoke a user's access; verify that the backend rejects synchronization and the device policy takes effect as designed.
  5. Simulate an ERP outage after the gateway accepts a request; verify that status is not incorrectly displayed as completed.

Treat these as release acceptance tests rather than a demonstration script.

Where the architecture discussion goes next

An enterprise phone application involves far more than a mobile UI: API gateways, systems of record, identity propagation, monitoring and rollback all shape whether offline work is trustworthy. For a broader architecture and procurement perspective, see enterprise mobile app architecture, costs and implementation .

For production security evaluation, OWASP MASVS is a useful reference for mobile storage, authentication and network controls.

Bottom line: the sync algorithm is only as good as its explicit conflict policy. When business data matters, “it eventually uploads” is not a sufficient acceptance criterion.

Represent pending work as commands with identity

A mobile application that edits a work order offline should not pretend it has updated the authoritative ERP record. Store a durable command containing an operation ID, work-order ID, expected version, intended change, and creation metadata. This separates the user’s intention from the server’s acceptance. The client can tell the technician that the operation is queued while the backend later decides whether the request remains valid.

The operation ID is particularly important when connections fail. A timeout does not prove that the ERP rejected the change. If the same operation is retried with a new identifier, the server may process it twice. Persisting a stable ID across restarts allows a backend to reject duplicates or return the known outcome. The implementation must also enforce that an identifier is never reused for a different payload.

Actual ERP capabilities matter. Some systems support caller-provided idempotency keys; others require a reconciliation lookup through a transaction reference. In systems without reliable deduplication interfaces, the integration design needs an explicit exception-handling plan rather than a blanket “retry until success” rule.

Separate network success from business acceptance

An HTTP 202 response can mean a backend accepted a command for processing, not that the ERP applied the business change. The mobile UI must convey that distinction. Consider a state machine with QUEUED, SUBMITTED, CONFIRMED, CONFLICT, and NEEDS_REVIEW. A queued command can survive an app restart. A submitted command remains pending until the authoritative operation is reconciled.

If an ERP adapter receives an ambiguous timeout after submitting an inspection, the correct immediate response may be to mark the command UNKNOWN and investigate through an approved status lookup. Simply treating timeouts as failures can trigger duplicates; treating them as successes can silently lose work. A durable outbox and correlation ID can help support teams reconstruct what happened across the mobile backend and integration layer.

Observability should report business-state measures such as median time to authoritative confirmation, oldest outstanding command, and number of unresolved conflicts. A healthy API success percentage can conceal a growing backlog of work orders that never completed.

Protect the authorization boundary after reconnect

A technician may have been authorized to edit a job when it was downloaded, but that does not mean the same permission still applies days later. Backend services should verify current object-level permissions when a queued write arrives, as required by the organization’s policy. Locally cached UI roles should never be accepted as the source of authority.

For a practical acceptance test, download work-order data, disconnect the device, revoke the technician’s access centrally, and then reconnect. Verify that the server blocks unauthorized changes, that the app displays an understandable outcome, and that any retained local data follows the relevant expiry or removal policy. A local “saved” status must not imply permission to commit that change indefinitely.

The OWASP Mobile Application Security Verification Standard is a useful starting point for evaluating storage, authentication, network security, and privacy controls, but the final tests must reflect actual enterprise data and workflows.

Frequently Asked Questions

Should mobile apps connect straight to ERP databases?

A controlled API or integration service is generally safer and easier to maintain because it can enforce authorization, validation, business rules, and versioned contracts.

What does an idempotency key solve?

It helps the server recognize retried logical operations so they do not create duplicate business effects. The backend must enforce uniqueness and verify the repeated payload.

Is last-write-wins safe for offline conflicts?

Only for selected low-risk data. Assignment, approval, inventory, and other consequential fields may need version checks or explicit review.

Can a queued offline action bypass a revoked role?

It should not. The backend should apply current authorization according to the organization’s policy when the operation reconnects.

What metrics reveal hidden integration failures?

Queue age, time to authoritative confirmation, unresolved conflicts, rejected commands, duplicate suppression, and ERP timeouts expose issues that ordinary HTTP status metrics may miss.

For a broader treatment of system integrations, offline operations, security, and budgets, see the enterprise mobile app development implementation guide.

Top comments (0)