cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
anka
Level: Powered On

Trigger a flow and button click

Hi,

 

I would like to trigger a flow from a powerapp form on button click.

 

I have 2 buttons on the form- 1. Save draft and 2. Submit. The idea behind Submit is to the let the 2nd person in chain to know request is completely filled and ready for processing. 

 

1. Save draft button checks the required columns in the list and and if the conditions passes, it creates a list item. 

2. Submit button runs a validation on the other fields of the form(This validation runs at teh form level). In order to be able to submit the request all all validations set on the form must pass.

 

I would like to send an email once the Submit is successful. I can't run it on item create since Save Draft already creates the item in the list.

 

Any ideas/suggestions are welcome.

 

 

Best,

3 REPLIES 3
Dual Super User
Dual Super User

Re: Trigger a flow and button click

Hi @anka 

 

Can you add an additional step at the end of flow to send success response to powerapps? This way it will only send the email when the flow execution is successful. Otherwise, if you do not wish to send after the flow execution is complete, you can directly send the email using Office365 Outlook connector. 
 
What is the data that you want to send in the email, if you wish to send last submitted entries, you can extract the values using Form1.LastSubmit.AttributeName.
 
Now, the expressions:
 
Without Response from flow:
If(Condition = true, FlowName.Run();Office365.SendEmailV2("ToEmail","Subject","This is the Email Body"&Form1.LastSubmit.Title))
 
With flow response:MicrosoftTeams-image (81).png

 

Set(ResponseReturned,testflow.Run().response);If(ResponseReturned = "success",Office365.SendEmailV2("ToEmail","Subject","This is the Email Body"))
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
anka
Level: Powered On

Re: Trigger a flow and button click

Hi @yashag2255,

 

Thank you for your suggestions, however I am not sure if I am following it completely. 

 

I would like to fire this flow(1 step floe that sends email via outlook) at OnSuccess event of the button click. I do not see such event in the button properties. I am not sure why I need to get the response from flow to powerapps. May be I am not very clear on the objective of the expression that you've listed and where/how to use it.

 

Here is how tried doing it but it didn't work, I created a text column 'Status' and on ButtonSelect, I am setting the value of the field to "True", The plan is fire the flow is the Status="True", and this is the formula I am using to set the status field "Set(ApplicationStatus, "Submit")". This formula is not setting the column value as desired. I tried changing the datatype to boolean, choice, but to no avail.  In theory it should have worked but it did not and I am not sure why.

 

Appreciate you looking into it.

 

 

Best,

 

Dual Super User
Dual Super User

Re: Trigger a flow and button click

Hi @anka 

 

If you want to send the email as soon as the submit is clicked, you can also add the send an email action in the flow itself.
 
The way I suggested was to make sure that the email is only sent when the flow execution is successfully. If by any chance, flow fails then it will not send the email. 
 
If you are looking to simply send the email, without checking for any validation, then you can add a second expression after the flow execution.
 
If(Condition = true, FlowName.Run();Office365.SendEmailV2("ToEmail","Subject","This is the Email Body"))
 
Here, If all the conditions are true, the flow will get executed and email will be sent. 
 
Note: Make sure you have connected to Office365 Outlook connector.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 176 members 5,390 guests
Please welcome our newest community members: