cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

How to Trigger a Flow From PowerApps within OnSave Event.

I have a simple power app that customizes the form from SharePoint.  Within the app I have several forms (New/Edit/View)... From the Edit field I have two buttons (Details and Comments).  I am using the Comments Button(tab) to allow people to submit comments.  Most will not have access to the other fields linked to the Details button).  From that comments area there is a field called comments that I patch to another list...  and stores the comments ( I do this within the OnSave Event) when they click save (it checks to see if the field is blank or not first).  Then in the view form I can pull all of the Comments and view them ... OK no problem with that.

 

Now I have a flow that on New it does stuff... and in the old version of WorkFlows I was able to create elaborate things easily... but since I am new to PowerApps and Flow... I am getting lost int he complicated logic... so I will create a few flows to do what I did with one before.... So on New Sharepoint item... it will run a flow and does stuff.... What I want is to run another flow if someone enters and saves a comment.... So in my head it should be easy... on the save click... it does what it does and immediate after if fires off a trigger to a flow... that does what it does (like send an email or ? really doesnt matter just want to trigger it).  

 

I have not been able to find the simple code that would be needed to trigger a flow... (or any examples)... Most examples are on new apps... but not on Customized forms...

 

 

(Here is a pic of the onSave Event that I have been using to test this all out)ITHelpHelp.jpg

 

 

thanks in advance, 

 

Rob

5 REPLIES 5
Highlighted
Super User
Super User

To trigger a flow from Powerapps you have to create the flow first and then go back to PowerApps and put in the run code.

 

Your trigger would be PowerApps and then I would suggest (since your using a SharePoint list) you do 'Get item' and you will ask for the ID of that item in PowerApps. 

 

Then in PowerApps you would need to run the flow on the OnSuccess of your form (are you using a Form?)

 

I did a video a while back that is not related to what you are needing but it does have a flow triggered by PowerApps just to give you some ideas..its here:

 

https://youtu.be/UdbNqQ1z_Ww

 

Highlighted

I will check out your video.  I have a flow to run... my problem is trying to get it to trigger from the onSave Event (see picture in initial post).  I figure just after the patch I could put a ; and a command that triggers it.... but I dont know what the command would be to trigger it... thought it would be easy (probably is)... but cant seem to find out what I am looking for... 

 

Basically what I am trying to do is trigger the flow to send a note saying a comment was added to this item... 

 

thanks for the reply and I am going to watch your video now.

Highlighted

You have to connect to the Flow in your app and then you use:

 

FlowName.Run(Ask1, Ask2)

 

Ask1 and Ask2 being whatever the fields in your Flow are that you selected 'Ask in PowerApps' for.

Highlighted
Community Support
Community Support

Hi @LBGrob ,

 

First of all, is it a standalone app created from PowerApps site or a customized form created from SharePoint site?

 

To start a flow from PowerApps, please refer to:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Not sure if I am stating this correctly but it is a PowerApp that customizes the forms in sharepoint.... so I got there from sharepoint.  I created 3 forms (new/view/edit)... in the edit form I want to trigger a flow that I created through sharepoint (or I guess create one in powerapps) that sends out an email on the onSave event of powerapps... in this email I want to include the ID of the sharePoint entry that was being edited.

 

so what I have been able to do is call a flow created through power app in the onsave event... I just am not sure how to pass on the ID variable from the form. 

 

 

Here is the latest code in the OnSave Event in SharePoint Integrations:

 

If(SharePointFormMode="CreateForm", SubmitForm(spFormNew),
If(SharePointFormMode="EditForm", SubmitForm(spFormEdit); If(!IsBlank(txbComment.Text), Patch(ListComments, {Title:"SomethingwillGoHere",ListName:"ITHelp",ItemID:SharePointIntegration.SelectedListItemID,Creator:User().FullName,Comment:txbComment.Text}); FlowFromPowerAppComments.Run(spFormEdit.LastSubmit.ID))))

 

I am using the.LastSubmit.ID for a lack of a better thing to use... it was the only one I could find to get the ID...but in the flow I couldnt call it... any thoughts on this.... the Flowname.run does call the flow.... and I can have it send an email...but havnt been able to pull info from the edit form.

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,056)