You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Power Automate Flow未触发求助:审批后触发Flow移动列表项

SharePoint列表审批按钮JSON格式化修正建议

针对你提供的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"
          }
        }
      ]
    }
  ]
}

关键修改说明

  1. 拆分Flow触发与状态更新:SharePoint列格式化不支持一个按钮同时执行executeFlow和setValue,建议把状态更新逻辑移到Power Automate Flow中——Flow触发后,先更新当前项的Status为Approved、ApprovalDecisionBy为当前用户,再执行移动操作,这样逻辑更集中可控。
  2. 修正Flex布局拼写:所有flex-directon改为flex-direction,确保按钮布局正常;新增gap: "8px"让两个按钮之间有间距,提升交互体验。
  3. 传递项目ID到Flow:在actionParams中添加"params":{\"itemID\":\"[$ID]\"},Flow可以通过triggerBody()['itemID']获取当前项ID,用于后续移动操作。
  4. 补全Reject按钮的action:添加"action": "setValue",确保点击Reject能正常更新状态。

内容的提问来源于stack exchange,提问作者Ram

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 00:31:02