I'm customizing a SharePoint edit form using Power Apps. I want to set the value of a global variable when the user edits a list item. The variable value will depend on a field value in the item being edited.
I've tried using the following code within the SharePointIntegration OnEdit event:
If(SharePointIntegration.Selected.'Status'.Value = "Active",
Set(varNextStatus,"Option 1"),
Set(varNextStatus,"Option 2")
);
EditForm(SharePointForm1);
This doesn't work consistently. It appears that sometimes it is referencing the previous record edited and sometimes the current record.
I've tried moving the EditForm command before the If statement, but I see the same behavior.
I found some posts that suggested calling the Refresh function. This generates an error, saying its not supported in this scenario.