cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sifu
Post Prodigy
Post Prodigy

How to pass the ID of new SPO item to flow

Hello guys,

i customized a Sharepoint online form with Powerapps, created a flow that is triggered when new item is created and so far all ok.

It now turns out that the performance of the flow (when i want to change something) is very poor and I would like to split the flow into 2 flows... to trigger the right flow i would like to remove "when item is created" and use the direct trigger on button:

Sifu_2-1608623179448.png

 

This could work fine but the flow must somehow find out which item it should handle, which item to change etc... (if more items get created). The best idea woiuld be to pass on the current item ID... the button would patch the values and last step would be sending the item ID... is that even a good approach? The problem I see is that the ID is not yet exisiting hence i would need to do some delay/timer and then trigger or something similar...not sure thats whre i need you help.

Alternatively, i could have a label that display current time from year to seconds and pass that on, use it as an ID, but dont like it so much...

1 ACCEPTED SOLUTION

Accepted Solutions

@Sifu 


Try this and see if it works:

 

ClearCollect(MYCollection,
            Patch(test, Defaults(test),
                 {Title: DataCardValue1.Text}
            )
);
'PowerAppFlowName'.Run(First(MYCollection).ID)

 

If you try above does it work?

View solution in original post

7 REPLIES 7

@Sifu 

 

To split up a Flow:

 

1) From a new Flow, use the HTTP Request trigger, then Save the Flow.

 

2) From the first Flow, use the HTTP Action* and then for the URL use the URL generated for the trigger in Step 1 above, and for the method of HTTP Action make sure POST is selected.

 

See if it helps @Sifu 

 

*If any issues, pass in a key of Content-Type and a value of application/json as one of the headers of HTTP Action in case.

hi, i would like to have just one flow per action.... the solution should be to start the right flow for the right action... that could be achieved by more "submit" buttons that call the right flow... but there must be a parameter that i pass on - which in my view should be the ID of an item...  

@Sifu 

 

Assuming you already did this part:

 

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

 

then try this:

 

1) On the Power Automate Flow trigger, add the parameters. You do this referring to above doc and inside the SharePoint action, using the "Ask In PowerApps" button - this button shows up under "Dynamic Content" when building out the Flow, and it will show up if/when/after you added the Power Automate Power Apps Trigger correctly as the trigger of the Flow.

 

2) These become passable parameters in the Formula Bar in the form YourFlowName.Run(YourParam1, [YourParam2,] etc...)

 

See if it helps @Sifu 

yes, but i want to pass on the ID parameter... the ID does not exist at the moment yet

@Sifu 

 

If using Patch you can try like this:

 

 

ClearCollect(MYCollectionForPatch
            ,
            Patch(SomeSharePointList
                 ,
                 Defaults(SomeSharePointList)
                 ,
                 {Title:"SomeTest",SomeProperty:"Something"}
            )
);

 

 

Then you may be able to do something like First(MYCollectionForPatch).ID

 

The other way to do it is you use SubmitForm, you may be able to access YourForm.LastSubmit.ID

 

Check if above helps @Sifu 

@poweractivate we are getting close!

Where did I lost you?

ClearCollect(MYCollection,
            Patch(test, Defaults(test),
                 {Title: DataCardValue1.Text}
            ));
'PowerAppFlowName'.Run(Value(ID.text))

@Sifu 


Try this and see if it works:

 

ClearCollect(MYCollection,
            Patch(test, Defaults(test),
                 {Title: DataCardValue1.Text}
            )
);
'PowerAppFlowName'.Run(First(MYCollection).ID)

 

If you try above does it work?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,485)