Power Automate Flow未触发求助:审批后触发Flow移动列表项
针对你提供的JSON代码,我整理了几个关键问题和修正方案,确保Approve按钮能正常触发Power Automate Flow并完成预期操作:
核心问题梳理
- 重复action字段导致Flow不触发:Approve按钮的
customRowAction里同时定义了executeFlow和setValue,JSON中重复键会被最后一个覆盖,实际只会执行状态更新,不会触发Flow。 - Flex属性拼写错误:多处
flex-directon应为flex-direction,会导致按钮布局异常。 - Reject按钮缺少action定义:未指定
action: "setValue",点击后无法更新状态。 - Flow触发未传递必要参数:Flow需要当前项的ID来执行移动操作,原代码未在
actionParams中传递项目标识。
修正后的完整JSON代码
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "style": { "flex-direction": "row", "justify-content": "left", "align-items": "center", "flex-wrap": "nowrap" }, "children": [ { "elmType": "div", "style": { "display": "=if([$Status] == 'In Progress', 'inherit','none')", "flex-direction": "row", "justify-content": "left", "align-items": "center", "flex-wrap": "wrap", "gap": "8px" }, "children": [ { "elmType": "button", "customRowAction": { "action": "executeFlow", "actionParams": "{\"id\":\"0000f4409-0081-0016-b459-4f000000001dfd\", \"params\":{\"itemID\":\"[$ID]\"}}" }, "attributes": { "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover" }, "style": { "border": "none", "background-color": "transparent", "cursor": "pointer", "display": "flex", "flex-direction": "row", "justify-content": "left", "align-items": "center", "flex-wrap": "wrap" }, "children": [ { "elmType": "span", "attributes": { "iconName": "SkypeCircleCheck" }, "style": { "padding": "4px" } }, { "elmType": "span", "txtContent": "Approve", "style": { "word-break": "keep-all" } } ] }, { "elmType": "button", "customRowAction": { "action": "setValue", "actionInput": { "Status": "Not Approved", "ApprovalDecisionBy": "@me" } }, "attributes": { "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover" }, "style": { "border": "none", "background-color": "transparent", "cursor": "pointer", "display": "flex", "flex-direction": "row", "justify-content": "left", "align-items": "center", "flex-wrap": "wrap" }, "children": [ { "elmType": "span", "attributes": { "iconName": "Blocked" }, "style": { "padding": "4px" } }, { "elmType": "span", "txtContent": "Reject", "style": { "word-break": "keep-all" } } ] } ] }, { "elmType": "div", "children": [ { "elmType": "span", "txtContent": "='This item is ' + toLowerCase([$Status])", "style": { "display": "=if([$Status] == '' , 'none','inherit')", "padding-left": "5px", "word-break": "keep-all" } } ] } ] }
关键修改说明
- 拆分Flow触发与状态更新:SharePoint列格式化不支持一个按钮同时执行
executeFlow和setValue,建议把状态更新逻辑移到Power Automate Flow中——Flow触发后,先更新当前项的Status为Approved、ApprovalDecisionBy为当前用户,再执行移动操作,这样逻辑更集中可控。 - 修正Flex布局拼写:所有
flex-directon改为flex-direction,确保按钮布局正常;新增gap: "8px"让两个按钮之间有间距,提升交互体验。 - 传递项目ID到Flow:在
actionParams中添加"params":{\"itemID\":\"[$ID]\"},Flow可以通过triggerBody()['itemID']获取当前项ID,用于后续移动操作。 - 补全Reject按钮的action:添加
"action": "setValue",确保点击Reject能正常更新状态。
内容的提问来源于stack exchange,提问作者Ram
相关产品推荐
相关产品推荐

