I have a SharePoint list form customized with PowerApps. A button to start a flow becomes visible only after the item has been saved and already has a SharePoint list ID. The button first changes a variable that sets a status field to "Submitted", then saves the form and then should start the flow, but every once in a while the flow does not start. I can see that the status field is changed and the item was saved, so these two commands were executed fine. Why does the flow not run sometimes?
The OnSelect code for the button is as follows:
Set(varSubmitted,true);SubmitForm(SharePointForm1);'MyFlowName'.Run(ID,"tr")
The OnSuccess of the SharePointForm1 is
ResetForm(SharePointForm1);
RequestHide()
What can I do to ensure that the flow runs every time and not just sometimes?
Hi @teylyn1
I think your problem is that when you perform a SubmitForm it's not always successful. Sometimes the data is not valid (e.g. required fields are missing) and the data is not saved or updated. Actions that need to be taken after a SubmitForm has been successful need to be in the OnSuccess property of the form so I would think that your Flow run should be initiated from there.
In the OnSuccess property you can access the record from the successful submit by referencing FormName.LastSubmit.FieldName so your Flow Run would be
'MyFlowName'.Run(SharePointForm1.LastSubmit.ID,"tr")
Hi @AnneZC , thanks for your reply. The SubmitForm was successful, since I can see that data was saved back to the item. I see it in the version history. If there were a problem with one of the fields, then the item would not have been saved. But it has, and the flow still did not run.
I also don't want to use the LastSubmit ID, since I already know the ID of the item, as it has been saved before. Maybe a minute ago, maybe yesterday. So I know the ID and don't need to use LastSubmit.
That's why I don't understand how the workflow won't start in some cases. All the data is there.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
209 | |
194 | |
82 | |
58 | |
38 |
User | Count |
---|---|
303 | |
249 | |
120 | |
83 | |
55 |