Tutorials/Power Apps/Offline Data Sync in Power Apps: Building a Resilient Field Inspection Tool
Power Appsintermediate

Offline Data Sync in Power Apps: Building a Resilient Field Inspection Tool

Explore how to create canvas apps that continue working without internet access and automatically synchronize once connectivity returns.

NA
Narmer Abader
@narmer · Published June 3, 2026

Mobile canvas apps are often used in environments where internet access is intermittent — shop floors, remote field sites, or underground facilities. Without a robust offline strategy, users can lose data or face errors when connectivity drops. This guide walks you through building a Power App that continues to function offline, saving changes locally, and automatically pushing them to the data source once the device reconnects.

We will use a fictional Field Equipment Inspection scenario, but the same pattern applies to any business process where offline resilience is required.

Scenario: Equipment Inspection App

A team of field technicians visits client locations to inspect heavy machinery. They record the equipment ID, their name, the date, a pass/fail status, and any comments. Internet connectivity in these industrial sites is often unreliable, so the app must store inspection records locally and sync them to a central SharePoint list when a connection becomes available.

For this solution we will use a SharePoint list named Inspections with the following columns:

ColumnTypeNotes
OfflineIDSingle line of textStores a GUID generated locally
EquipmentIDSingle line of textUnique identifier for the equipment
TechnicianSingle line of textName of the technician performing check
InspectionDateDate and timeDate and time of the inspection
StatusChoice (Pass / Fail)Inspection result
CommentsMultiple lines of textAdditional observations

Populate the list with a few sample records to test the app later. Each row needs a unique GUID in the OfflineID column. You can generate these manually or use the GUID() function inside Power Apps during initial setup (we will cover that in the offline create scenario). For the walkthrough, assume the following three rows exist:

  • OfflineID: d1b2c3a4-..., EquipmentID: EXC-001, Technician: Alice
  • OfflineID: e5f6g7h8-..., EquipmentID: EXC-002, Technician: Bob
  • OfflineID: i9j0k1l2-..., EquipmentID: EXC-003, Technician: Alice

Step 1: Load Data into a Collection

Open Power Apps and create a blank canvas app. Connect it to the Inspections SharePoint list. In the OnStart property of the app, load the SharePoint list into a local collection.

powerfxApp OnStart
ClearCollect(colInspections, Inspections);

This collection will serve as the offline working copy. We will also use SaveData and LoadData to persist it on the device.

Add a new screen named GalleryScreen. Insert a Vertical Gallery and set its Items property to colInspections. The gallery will display all inspections loaded from SharePoint. When the user taps an item, we store the selected record in a global variable and prepare a form for editing.

powerfxGallery OnSelect
Set(varSelectedInspection, ThisItem);
Navigate(EditScreen, ScreenTransition.Fade);

Step 3: Edit Screen – Modify an Inspection

Add a new screen named EditScreen and place an Edit form (frmInspection) on it. Set the form’s DataSource to Inspections and its Item property to varSelectedInspection.

Hide the OfflineID card by setting its Visible property to false — users do not need to see the internal GUID.

Include a Submit button below the form. The button must perform three actions when clicked:

  1. Patch the local collection with the form data.
  2. Persist the collection to the device using SaveData.
  3. Mark the record as pending sync in a separate collection, then navigate to the saving screen.
powerfxSubmit button OnSelect
// Update local collection with form changes
Patch(
  colInspections,
  LookUp(colInspections, OfflineID = varSelectedInspection.OfflineID),
  frmInspection.Updates
);

// Save the entire collection to the local device
SaveData(colInspections, "localInspections");

// Track which record still needs to be synced to SharePoint
Collect(colPendingSync, {OfflineID: varSelectedInspection.OfflineID});

// Persist the pending list too
SaveData(colPendingSync, "localPendingSync");

// Go to the saving screen
Navigate(SavingScreen, ScreenTransition.None);

Tip: If you let the user create new inspections offline, generate the OfflineID using the GUID() function inside the form’s default value for that field. That ensures each new record has a unique identifier before the app goes offline.

Step 4: Admin Screen – Debug Mode Toggle

While building the app you do not want the automatic sync logic to run every time you preview a screen. Create an additional screen called AdminScreen and add a Toggle control named togDebug. Set its Default to false. When togDebug is true, the loading and saving screens will skip their automatic actions, letting you test the app without interfering with the offline logic.

Step 5: Saving Screen – Sync Pending Records

The saving screen performs the synchronization when the device is online. Add a label (lblSyncStatus) and a button (btnSyncActions). In the screen’s OnVisible property, trigger the button unless debug mode is active.

powerfxSavingScreen OnVisible
If(!togDebug, Select(btnSyncActions));

Place the actual sync logic inside the button’s OnSelect.

powerfxbtnSyncActions OnSelect
If(
  Connection.Connected,
  With(
      {
          recordsToSync: Filter(
              colInspections,
              OfflineID in colPendingSync.OfflineID
          )
      },
      Patch(
          Inspections,
          ShowColumns(recordsToSync, "ID", "OfflineID", "EquipmentID", "Technician", "InspectionDate", "Status", "Comments")
      )
  );
  Clear(colPendingSync);
  SaveData(colPendingSync, "localPendingSync");
  lblSyncStatus.Text = "All records synced successfully.";
  Navigate(GalleryScreen, ScreenTransition.None);
,
  lblSyncStatus.Text = "No internet connection. Records saved locally."
);

Caution: The ID column shown in ShowColumns is the SharePoint auto‑generated integer. It must be included for Patch to update an existing record; otherwise Patch will insert a duplicate. If you are only inserting new offline records, omit ID.

Step 6: Loading Screen – Restore Data on App Start

When the app launches after a period of offline usage, you must load any locally saved data back into the collections. Add a screen named LoadingScreen with its OnVisible set to run the restoration automatically.

powerfxLoadingScreen OnVisible
If(
  !togDebug,
  If(
      !IsEmpty(LoadData(colInspections, "localInspections")),
      Notify("Offline data restored", NotificationType.Success);
      // Rebuild pending list from its own persisted file
      LoadData(colPendingSync, "localPendingSync");
      If(CountRows(colPendingSync) > 0,
          Navigate(SavingScreen, ScreenTransition.None),
          Navigate(GalleryScreen, ScreenTransition.None)
      ),
      Navigate(GalleryScreen, ScreenTransition.None)
  )
);

The LoadData function restores the last saved state of colInspections and colPendingSync from the device. If there are pending records, the app will immediately try to sync them.

Performance and Security Considerations

  • Storage limits: SaveData can store up to 30 MB of data on the device. Keep your collections small enough to stay under that limit. Use OnStart to filter only the records the user needs offline.
  • Sensitive data: The data persisted by SaveData is stored in an app‑specific sandbox that is encrypted by the device’s operating system. Still, avoid storing highly confidential information without additional encryption.
  • Delegation: When you load data from SharePoint into a local collection, you must respect delegation limits (default 500 records). Use larger limits or filter the query to avoid loading unmanageable amounts of data.
  • Conflict resolution: The sync pattern in this article assumes the last write wins. For multi‑user scenarios, consider adding a timestamp column and implementing conflict detection.

Common Mistakes and Troubleshooting

IssueLikely Fix
SaveData / LoadData errors when previewing in browserTest on an actual device or emulator; these functions do not work in the browser.
OfflineID duplicates after restoring from backupEnsure GUID() is called at record creation, not reused.
Pending sync collection becomes empty after restartRemember to call SaveData(colPendingSync, "localPendingSync") every time you add to the collection.
SharePoint Patch fails with 404 on existing recordsConfirm the ID column is included in ShowColumns.
Debug toggle does not prevent automatic navigationVerify the toggle is in a screen that is visible before the loading/saving screen runs.

Final Recommendation

The offline pattern presented here — local collections, SaveData/LoadData, and a pending‑sync list — is mature enough for production scenarios where data volumes are moderate and conflicts are rare. Always test on real devices under low‑connectivity conditions. For more advanced requirements (e.g., conflict detection, large datasets, Dataverse offline profiles), refer to the official Microsoft documentation.

References