Forum Discussion
PriyaRaskar
Apr 02, 2023Copper Contributor
Hi Sprinx,
There is no direct trigger to detect new attachment. But you can use a workaround like, add JSON formatting on List column to trigger workflow directly from list. So when new attachment is added to list item, you can click button to run workflow that will send email to listed users.
Heres a sample JSON formatting I used to trigger workflow from List
NOTE: Use "for a selected item" trigger in workflow.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"YOUR WORKFLOW ID\"}"
},
"attributes": {
"class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
},
"style": {
"border": "none",
"background-color": "transparent",
"cursor": "pointer"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "Mail"
},
"style": {
"padding-right": "16px"
}
}
]
}
There is no direct trigger to detect new attachment. But you can use a workaround like, add JSON formatting on List column to trigger workflow directly from list. So when new attachment is added to list item, you can click button to run workflow that will send email to listed users.
Heres a sample JSON formatting I used to trigger workflow from List
NOTE: Use "for a selected item" trigger in workflow.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"YOUR WORKFLOW ID\"}"
},
"attributes": {
"class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
},
"style": {
"border": "none",
"background-color": "transparent",
"cursor": "pointer"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "Mail"
},
"style": {
"padding-right": "16px"
}
}
]
}
- Sung_GeonCAug 12, 2024Copper Contributor
Thank you for the JSON! What do I put for 'YOUR WORKFLOW ID'? I don't know what to put for that.
- ganeshsanapAug 14, 2024MVP
If you are trying to run a flow using SharePoint JSON formatting as suggested by Priya, follow this Microsoft official documentation for steps to get Power automate flow ID: SharePoint JSON formatting - create a button to launch a Flow
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.