So I have read of a technique to create a button in a column of a SharePoint list that will trigger a Flow when clicked. This requires the flow to be set for "For selected item". I have this flow set but one of the parameters to the code is the Flow ID, this should be a GUID. For the life of me I can not figure out where to get this value from, any ideas?
Link to code: http://yannickborghmans.com/2017/11/14/start-your-ms-flow-from-within-the-new-sharepoint-column-formatter/
You can do it dynamically within the flow itself using
@{concat('https://make.powerautomate.com/environments/',workflow()['tags']['environmentName'],'/flows/',workflow()['tags']['logicAppName'],'/runs/',workflow()?['run']?['name'])}
I have been using this method for retrieving the flow id for a couple of years now. I've just tried to create a button that triggers a flow from a SharePoint list and I no longer see the ID in the URL when in edit mode of the Flow.
Now, the url only shows the default tenant ID and after the /logicflows. That's the extent of the URL. You now need to go to the Export option above the details section of your flow and select Get Flow Identifier.
Thanks!
I have been trying off and on for maybe a year to figure out how to parametrically generate links to specific flow runs to include with the SharePoint records they edit so I can debug and troubleshoot far more efficiently, but I have yet to come up with anything better than hard-coding the URL, until now. Thanks again @NaveenkumarT !!
Whole problem was I assumed the FlowId from the URL would be found in the workflow() output, and then I could figure out which parameter to use by CTRL+C and CTRL+F the FlowId from flow URL. But that assumption was bad since I was editing a flow in a dev environment. I gave up every time I tried to solve this issue. Turns out there was an internet time traveler from 2020 reaching out all along with the solution!
@NaveenkumarT I have a manually triggered flow in an unmanaged solution in my dev environment. Both the EnvironmentId and the FlowRunId are included in the workflow() output and both match their corresponding workflow() key values, tags.environmentName and run.name, respectively.
My issue is that tags.logicAppName does NOT match the FlowId as shown in the URL!
I have noticed that workflow()?tags.logicAppName is the same value as workflow()?name. Is that supposed to be like that or why does my logicAppName not match the value of flows/<FlowId> in the URL?
_____
Oh wow, I spoke too soon... I have just tested this and the non-matching logicAppName still works! I believe the reason for the difference has something to do with this being a dev environment. I forget what the setting is called but it's different for my dev vs. prod environments, and, for instance, that changes the length of the GUID for flows and whatnot. Prod flows seem to have shorter GUIDs. If you compared a prod flow's logicAppName and flows/<FlowId> values, maybe they would match, unlike in the dev environment. Regardless, you can use the logicAppName value even if it does not match the URL. Previously I had gone looking for the correct parameter by CTRL+F'ing my flows/<FlowId> value, but that was fruitless in the dev environment. Learn something every day!
EDIT: Just because someone else out there might find my use case helpful, here's the solution I devised (with help from Naveen!) to populate a column of clickable hyperlinks which open the last flow to edit a record.
First, you'll need to add a hyperlink column, call it FlowRunURL. Edit your flow and add a Compose action in Power Automate to parametrically create the URL string using workflow() parameters instead of hard-coded strings (like I was doing before I read this thread):
@{concat('https://make.powerautomate.com/environments/',workflow()['tags']['environmentName'],'/flows/',workflow()['tags']['logicAppName'],'/runs/',workflow()?['run']?['name'])}
Then create a SharePoint HTTP PATCH request, with the following headers (this assumes your record exists. you may need Method:POST and different headers if creating a new record):
{
"content-type": "application/json;odata=verbose",
"IF-MATCH": "*",
"X-HTTP-Method": "MERGE"
}
And create a compose action which you'll use for the HTTP PATCH Body ('Workflow' is the name I gave to the compose action which creates the URL string):
{
"__metadata": {
"type": "SP.Data.<Name of your list goes here>ListItem"
},
"FlowRunURL": {
"Description": "click to open last flow to edit this record",
"Url": "@{outputs('Workflow')}"
}
Then just make sure to put the output of that compose action as the Body parameter for your HTTP PATCH request, like so:
@{outputs('ComposePATCH')}
Late reply, but this could be useful to someone.
Use the below expressions.
EnvironmentId - workflow()['tags']['environmentName']
FlowId - workflow()['tags']['logicAppName']
FlowRunId - workflow()['run']['name']
Is it available as some parameter so that I can use it in the actions?
Mabel,
Thank you so much. I never even thought of looking at the URL. I knew it would be something simple that I was overlooking.
Hi @MikeLockwood,
Thanks for updating.
To get the Flow Id, in edit mode, you could get it from the highlighted part:
Best regards,
Mabel Mao
Hello Mike,
to find the flow ID, go to flow and in the browser input bar, you will see something like this
so here : b060f2b9-65ac-46d1-bee6-6ca4f54c03f8 is probably the flow id.
Let me know if that works.
Cheers
Serge Luca
Mabel,
This is a simple question on how do i get the GUID ID of a specific Flow. I would figure that the Flow board would be the best place for this question but I will post it in the SharePoint forum as well.
Thanks,
Mike Lockwood
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,079
Most Valuable Professional