Run-after:优雅处理失败

Power Automate 中级

Dani Kahil

Solution Architect | Microsoft MVP

Power Automate 中没有 try-catch

nanobanana: 纯白背景的极简插画。左侧为红色删除线且已淡化的 "try / catch" 文本。右侧是一张标有 "Send an email" 的动作卡片,下面有四个小状态徽章:"Success"、"Failed"、"Skipped"、"Timed out",配有 DataCamp 绿色对勾和红色叉号。从左到右有一支粗体箭头。

 

  • 没有 try / catch 关键字
  • 每个动作都有 run-after 设置
  • Run-after = 由哪些前置步骤状态触发本步骤
Power Automate 中级

四种 run-after 状态

nanobanana: 纯白背景的极简插画,四个等宽水平胶囊形状态徽章一字排开,依次标注:"is successful"(DataCamp 绿色带对勾)、"has failed"(红色带叉号)、"is skipped"(灰色带短横)、"has timed out"(琥珀色带时钟图标)。极简、无阴影、四者权重相同。

 

  • is successful — 默认
  • has failed — 动作出错
  • is skipped — 被 Condition 或 Scope 跳过
  • has timed out — 超出时间限制
Power Automate 中级

并行分支:失败处理的常用模式

$$

mermaid: green-navy: "Send an email" 分支为成功路径与并行失败处理,后者记录到 SharePoint

 

  • 在高风险动作后添加 并行分支
  • 将其 run-after 设为 has failed 或 has timed out
  • 原路径保持默认 is successful
Power Automate 中级

最常见的 run-after 错误

 

screenshot_run_after_dialog_default_is_successful: Power Automate 的 run-after 配置对话框,含 is successful、has failed、is skipped、has timed out 四个复选框——仅 is successful 被勾选,并有标注提示其为需修改的默认值

 

  • 使用默认值的失败处理器永远不会触发
  • 新分支会继承 is successful
Power Automate 中级

重试:并行分支提供冗余

nanobanana: 纯白背景的极简插画,一张标有 "Send an email — primary" 的动作卡,下方是其下游的 "Send an email — backup connector",两者以虚线箭头相连并标注 "has failed"。备卡片自身下游有 "Log success" 胶囊。DataCamp 绿色与海军蓝,极简风。

 

  • 用 run-after 串联在不同连接器上重试
  • 并行分支让原路径保持独立
Power Automate 中级

让我们一起练习吧!

Power Automate 中级

Preparing Video For Download...