Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save chrisobriensp/75f443f29f95d67b9bb970a38575396e to your computer and use it in GitHub Desktop.

Select an option

Save chrisobriensp/75f443f29f95d67b9bb970a38575396e to your computer and use it in GitHub Desktop.
PowerApps formula to save a record locally if device is offline, or submit it to datasource otherwise.
If(
Connection.Connected,
Patch(
'My SharePoint list',
Defaults('My SharePoint list'),
{
Title: Concatenate(
"Leave Request - ",
User().Email,
" - ",
Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm"
)
),
Requestor: currentUser,
RequestorStaffNumber: txtRequestorStaffNumber.Text,
LeaveRequestType: LeaveType
}
);
Navigate(
ConfirmationScreen,
ScreenTransition.Fade
),
ClearCollect(
LocalRecord,
{
Title: Concatenate(
"Leave Request - ",
User().Email,
" - ",
Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm:ss"
)
),
Requestor: currentUser,
RequestorStaffNumber: txtRequestorStaffNumber.Text,
LeaveRequestType: LeaveType
}
);
SaveData(LocalRecord, "LocalRecord");
Navigate(
PendingScreen,
ScreenTransition.Fade
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment