I have a power app that runs a flow from the OnSuccess property of a screen form. When a user clicks on a "Submit" button and submits the form the flow should run. It's not. I've run my app in Monitor and I get no errors. In Power Automate I can see the flow has not even started when I test the app. I have had this working in the past and I can't figure out why it's not working. I deleted the flow from the power app, saved and re-added the flow. I've removed the code from the OnSuccess property, deleted the flow from the power app, saved and re-added the flow, and re-added the OnSuccess code. I've checked the flow, data, connections and they are all fine.
Can you please help me, perhaps with the screenshots attached. I've highlighted the processing at the OnSuccess property step. I'm at a total loss. 😞
Andy
Screen: Request
Form: ItemForm
Flow: SMPIIEBuildApp-SendApprovaleMail
Flow Parameters: ItemID (number), ApproveReject (string)
Solved! Go to Solution.
I hope you are using the syntax as
Set(varTempApproveReject, "Approve"),
Set(varTempApproveReject, "Reject"),
Set(varTempApproveReject, "Submit")
@AndyMcV01 This is not the solution but I want to try something here.. Can you create a button and put the flow run code under OnSelect of button.. Now in your Form' OnSuccess property.. can you call the Select(Button)?.. Just to check if flow is triggered from PowerApps itself or not?
Also check if flow is turned on.
Hi Sunil
Ok I did as you say. I get the same result from the button (called btnTest) and the flow didn't start.
In the form's OnSuccess code I put the following.
Select(btnTest);
In the button's OnSelect code I put the following.
'SMPIIEBuildApp-SendApprovaleMail'.Run(ItemForm.LastSubmit.ID, varTempApproveReject);
Notify("From button - The request has been submitted and the approver/reviewer has been notified.", NotificationType.Success);
Navigate(Home);
I attached the monitor results when I processed the form, which called the code in the btnTest button. I checked too and the flow is turned on. 😄
Andy
@AndyMcV01 Can you share your flow pic here..? Trigger & Actions..? Just to understand what is happening inside flow..
@AndyMcV01 Looks good to me.. the values that you are passing from PowerApps to Flow.. are they of the same type as being asked in Flow? so can you make sure that the varTempApproveProject is of type text/string and LastSubmit.ID of type number (I don't doubt this will be challenge.. but just double checking.. at least lastsubmit.id)?
@Sunil-Narnaware for the varTempApproveReject variable, the user can click on an Approve, Reject, or Submit button and this submits the form and tells the flow what action the user took. For each of those in the OnSelect property the variable is set.
varTempApproveReject = "Approve";
SubmitForm(ItemForm);
varTempApproveReject = "Reject";
SubmitForm(ItemForm);
varTempApproveReject = "Submit";
SubmitForm(ItemForm);
The OnSuccess property of the form then grabs these values. I assume that these would be treated as a string.
I'm not sure how to check the ItemForm.LastSubmit.ID and I can only assume it would be a number. How can I check this?
I hope you are using the syntax as
Set(varTempApproveReject, "Approve"),
Set(varTempApproveReject, "Reject"),
Set(varTempApproveReject, "Submit")
@Sunil-Narnaware haha nope. Just varTempApproveReject = "Approve" for example. Interesting point.
At the same time I added the following code to the OnSelect of the btnTest button to test if the ItemForm.LastSubmit.ID is numeric:
If(IsNumeric(ItemForm.LastSubmit.ID),Notify("ItemForm.LastSubmit.ID is a number.", NotificationType.Success), Notify("ItemForm.LastSubmit.ID is NOT a number.", NotificationType.Success));
Now when I run the app and submit the form I get the following error:
SMPIIEBuildApp-SendApprovaleMail'.Run failed: The method 'Run' has an invalid value for parameter 'text'
I'll change the code from varTempApproveReject = "Approve" to Set(varTempApproveReject, "Approve") and for the reject and submit. Let's see if this fixes anything.
In Power Apps, the only way you can set value of variable is using Set function
User | Count |
---|---|
172 | |
95 | |
74 | |
72 | |
57 |
User | Count |
---|---|
215 | |
165 | |
96 | |
93 | |
74 |