web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Offline Powerapps-Sync...
Power Apps
Unanswered

Offline Powerapps-Sync issue

(0) ShareShare
ReportReport
Posted on by 220

Hello, I am trying to add an offline functionality in my app. The code is buggy, sometimes it works and sometime it does not. I am seeking your help in this. Below is my code on submit button.

If(
 Connection.Connected ,
Patch(
 'Dev_Data.RecordOut',
 Defaults('Dev_Data.RecordOut'),
 {
 Asset: Dropdown1_2.Selected.Asset,
 AssetLocationFrom: drpFrom.Selected.AssetLocation,
 AssetLocationTo: drpTo.Selected.AssetLocation,
 ByResource: drpByResource.Selected.LabourerName,
 ID: Last('Dev_Data.RecordOut').ID + 1,
 ReturnDate: dteReturn.SelectedDate
 }
);
Refresh('Dev_Data.RecordOut');
ClearCollect(LocalIssues,'Dev_Data.RecordOut');
SaveData(LocalIssues,"offlineissues"),

Collect(localchanges,
{Asset: Dropdown1_2.Selected.Asset,
 AssetLocationFrom: drpFrom.Selected.AssetLocation,
 AssetLocationTo: drpTo.Selected.AssetLocation,
 ByResource: drpByResource.Selected.LabourerName,
 ID: Last(localchanges).ID + 1,
 ReturnDate: dteReturn.SelectedDate,
 ChangeType : "a"});
 SaveData(localchanges,"offlinechanges");
 
 UpdateContext({popup:true}))
 
 
 
 

and this is the code in the timer on end.

If(
 Connection.Connected && CountRows(localchanges) > 0,
 ForAll(
 localchanges,
 If(
 ChangeType = "a",
 Patch(
 'Dev_Data.RecordOut',
 Defaults('Dev_Data.RecordOut'), 
 {
 Asset: Dropdown1_2.Selected.Asset,
 AssetLocationFrom: drpFrom.Selected.AssetLocation,
 AssetLocationTo: drpTo.Selected.AssetLocation,
 ByResource: drpByResource.Selected.LabourerName,
 ID: Last('Dev_Data.RecordOut').ID +1 ,
 ReturnDate: dteReturn.SelectedDate
 }
 )
 )
 )
);
Clear(localchanges);
Refresh('Dev_Data.RecordOut');
ClearCollect(
 LocalIssues,
 'Dev_Data.RecordOut'
);
SaveData(
 LocalIssues,
 "offlineissues"
)

 

 

 

The data collected offline does not sync all the time, but sometimes it does. My doubt is with the ID column in the source.

Also, the datasource I have is MySql.

 

Please suggest. thanks in advance.

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard