I have a column (Review and Approval) which shows a button if the value is Start Workflow, and clicking it opens a flow in Power Automate. In the example below the ID of the power Automate Flow is 0123456789 (See below: Json code column Review and approval:) .
I need to have the result of a choice column instead of 0123456789. See below what I've tried (Idea I tried:).
I added a column Approval_Flow_ID, and replaced 01234567879 with [$Approval_Flow_ID], but the button doesn't show.
Any Idea's? THANXX
Json code column Review and approval:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "@currentField",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"01234567890"}"
},
"style": {
"background-color": "#008082",
"color": "white",
"border-radius": "0 15px",
"visibility": "=if((@currentField == 'Start Workflow'),'visible','hidden')"
}
}
Idea I tried:
Json code column Review and approval:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "@currentField",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"[$Approval_Flow_ID]"}"
},
"style": {
"background-color": "#008082",
"color": "white",
"border-radius": "0 15px",
"visibility": "=if((@currentField == 'Start Workflow'),'visible','hidden')"
}
}
Solved! Go to Solution.
I indeed didn't have it visable.
I'll try putting the Flow ID into the column that presents the button. If I format the color of the text the same as the body it should work.
I don't want to have the select column for the flow active because general users won't require it, and may switch off.
Thanks!
Hi @rolanddaane ,
to me this question may better be posted in a SharePoint forum, but I'll give it a try.
Is the column "Approval_flow_ID" visible? In column formatting you can only access those columns that are currenly visible in the table. So if you have hidden the column "Approval_flow_ID", the other column cannot access it.
Additionally, you have a syntax error in your code. After "[$Approval_Flow_ID]" there is backslash missing. It should read '\"[$Approval_Flow_ID]\"'.
Regards,
Leo
---------------------------------------------------
If my answer solved your issue, please mark it as complete.
If what I wrote helped you, please give it a thumbs up.
I indeed didn't have it visable.
I'll try putting the Flow ID into the column that presents the button. If I format the color of the text the same as the body it should work.
I don't want to have the select column for the flow active because general users won't require it, and may switch off.
Thanks!
Hi @rolanddaane , did you get this working? I am facing the same scenario where I want to trigger a different flow from a button, based on the column value that contains the flow ID (@currentField).
I'm struggling to get the syntax right.
After a bit more searching online I managed to get it working. The correct syntax for the customRowAction property is the following, in my case:
"customRowAction": {
"action": "executeFlow",
"actionParams": "='{\"id\": \"' + @currentField + '\"}'"
}
I was struggling to put it all together, and forgot the '=' sign. I hope this helps someone.
I tried that but that throws an unexpected end of Json error
Because I want to take the value from the column Approval_Flow_ID (and not @currentField, I need something like this....
"customRowAction": {
"action": "executeFlow",
"actionParams": "='{\"id\": \"' + [$Approval_Flow_ID] + '\"}'"
}
Hi @rolanddaane
Funnily enough I was experimenting with just that scenario earlier this week. I got it to work with the following code, which looks to be exactly the same way as what you pasted. Just make sure that you're using the internal column name to reference the field (in my case it was 'FlowID')
"customRowAction": {
"action": "executeFlow",
"actionParams": "='{\"id\": \"' + [$FlowID] + '\"}'"
}
If you're getting an "unexpected end of JSON" error maybe the problem lies elsewhere (forgot a comma, closing bracket or parentheses...).
User | Count |
---|---|
22 | |
15 | |
14 | |
10 | |
9 |
User | Count |
---|---|
43 | |
28 | |
25 | |
24 | |
23 |