May 17 2023 04:05 AM
Hi 🙂
I have created a list in sharepoint to perform purchase approvals. The list is linked to PowerAutomate. So far my users who can approve orders get a query in Teams and Outlook from approvals. Can I make a button in sharepoint next to each order so that it can also be accepted from sharepoint?
May 17 2023 05:14 AM - edited May 17 2023 05:16 AM
Solution@SebastianSzyroki you can do this with JSON column formatting. Create a single line of text column and format it in advanced mode with the following JSON. You will need to change the actionParams line to your flow's ID and you can change the CSS in the style section, the icon and the button text in the txtContent line. When the user clicks the button it will trigger the approval flow.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"50097cde-b800-4c6c-ade9-95be7574f4e5\"}"
},
"style": {
"border": "none",
"background-color": "#f6ec6a",
"cursor": "pointer"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "Flow"
},
"style": {
"padding-right": "6px"
}
},
{
"elmType": "span",
"txtContent": "Send to Manager"
}
]
}
Rob
Los Gallardos
Microsoft Power Automate Community Super User
May 17 2023 05:38 AM
@RobElliott thanks for your help but still not working for me. The button does not appear I added a single line of a text column and added this code in the formatting:
code:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"v1/Default-e901769d-6aee-4e9d-8494-32da90ceb00a/47b8c80a-367c-4f2a-bb20-10aee385d243\"}"
},
"style": {
"border": "none",
"background-color": "#f6ec6a",
"cursor": "pointer"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "Flow"
},
"style": {
"padding-right": "6px"
}
},
{
"elmType": "span",
"txtContent": "zatwierdz"
}
]
}
I have a question if my code to flow is this:
v1/Default-e901769d-6aee-4e9d-8494-32da90ceb00a/47b8c80a-367c-4f2a-bb20-10aee385d243 should i add it like this?:
"actionParams": "{\"id\": \"v1/Default-e901769d-6aee-4e9d-8494-32da90ceb00a/47b8c80a-367c-4f2a-bb20-10aee385d243\"}"
May 17 2023 05:49 AM
May 17 2023 06:00 AM - edited May 17 2023 06:07 AM
@RobElliott great, the button works, but it's probably the button to start the flow (for me, the flow starts automatically). I meant that the approver could click the button and then select approve/reject the request or that this window would appear - the same as it does through the approval add-on in MS Teams.
maybe there is some command instead of "action": "executeFlow", on approveFlow ??
May 17 2023 06:29 AM
@SebastianSzyroki I don't think it is possible to approve/reject flow approval directly from SharePoint list using default capabilities of SharePoint and SharePoint JSON formatting.
There is no default action like approveFlow in SharePoint JSON formatting.
Here's is what you can do:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
May 25 2023 04:32 AM
@SebastianSzyroki Did you try the steps given in my response above? Is it working for you?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
May 17 2023 05:14 AM - edited May 17 2023 05:16 AM
Solution@SebastianSzyroki you can do this with JSON column formatting. Create a single line of text column and format it in advanced mode with the following JSON. You will need to change the actionParams line to your flow's ID and you can change the CSS in the style section, the icon and the button text in the txtContent line. When the user clicks the button it will trigger the approval flow.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"50097cde-b800-4c6c-ade9-95be7574f4e5\"}"
},
"style": {
"border": "none",
"background-color": "#f6ec6a",
"cursor": "pointer"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "Flow"
},
"style": {
"padding-right": "6px"
}
},
{
"elmType": "span",
"txtContent": "Send to Manager"
}
]
}
Rob
Los Gallardos
Microsoft Power Automate Community Super User