跳到正文
Skillpedia
API 与服务器(后端)40k · #7414

salesforce-flow-design

它能做什么

这份指南可以帮助你正确、安全地构建 Salesforce 自动化流程(Flow)。它会教你如何选择合适的流程类型、避免常见错误,并确保自动化即使在处理大量数据时也能良好运行。

适用场景

  • ✓开始构建新的自动化流程时。
  • ✓审查现有流程,确保其构建良好时。
  • ✓流程出现错误或运行不正常时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/salesforce-flow-design/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/salesforce-flow-design/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“如果很多客户同时被更新,我怎样才能确保我的销售流程不会崩溃?”

每周 5 个新技能,1 分钟读完。

工作原理

这份指南会检查你是否为需求选择了合适的流程类型,以及流程是否能够一次处理大量数据记录。它还会演示如何添加错误保护。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Salesforce Flow Design and Validation

Apply these checks to every Flow you design, build, or review.

Step 1 — Confirm Flow Is the Right Tool

Before designing a Flow, verify that a lighter-weight declarative option cannot solve the problem:

Requirement Best tool
Calculate a field value with no side effects Formula field
Prevent a bad record save with a user message Validation rule
Sum or count child records on a parent Roll-up Summary field
Complex multi-object logic, callouts, or high volume Apex (Queueable / Batch) — not Flow
Everything else Flow ✓

If you are building a Flow that could be replaced by a formula field or validation rule, ask the user to confirm the requirement is genuinely more complex.

Step 2 — Select the Correct Flow Type

Use case Flow type Key constraint
Update a field on the same record before it is saved Before-save Record-Triggered Cannot send emails, make callouts, or change related records
Create/update related records, emails, callouts After-save Record-Triggered Runs after commit — avoid recursion traps
Guide a user through a multi-step UI process Screen Flow Cannot be triggered by a record event automatically
Reusable background logic called from another Flow Autolaunched (Subflow) Input/output variables define the contract
Logic invoked from Apex @InvocableMethod Autolaunched (Invocable) Must declare input/output variables
Time-based batch processing Scheduled Flow Runs in batch context — respect governor limits
Respond to events (Platform Events / CDC) Platform Event–Triggered Runs asynchronously — eventual consistency

Decision rule: choose before-save when you only need to change the triggering record's own fields. Move to after-save the moment you need to touch related records, send emails, or make callouts.

Step 3 — Bulk Safety Checklist

These patterns are governor limit failures at scale. Check for all of them before the Flow is activated.

DML in Loops — Automatic Fail

Loop element
  └── Create Records / Update Records / Delete Records  ← ❌ DML inside loop

Fix: collect records inside the loop into a collection variable, then run the DML element outside the loop.

Get Records in Loops — Automatic Fail

Loop element
  └── Get Records  ← ❌ SOQL inside loop

Fix: perform the Get Records query before the loop, then loop over the collection variable.

Correct Bulk Pattern

Get Records — collect all records in one query
└── Loop over the collection variable
    └── Decision / Assignment (no DML, no Get Records)
└── After the loop: Create/Update/Delete Records — one DML operation

Transform vs Loop

When the goal is reshaping a collection (e.g. mapping field values from one object to another), use the Transform element instead of a Loop + Assignment pattern. Transform is bulk-safe by design and produces cleaner Flow graphs.

Step 4 — Fault Path Requirements

Every element that can fail at runtime must have a fault connector. Flows without fault paths surface raw system errors to users.

Elements That Require Fault Connectors

  • Create Records
  • Update Records
  • Delete Records
  • Get Records (when accessing a required record that might not exist)
  • Send Email
  • HTTP Callout / External Service action
  • Apex action (invocable)
  • Subflow (if the subflow can throw a fault)

Fault Handler Pattern

Fault connector → Log Error (Create Records on a logging object or fire a Platform Event)
               → Screen element with user-friendly message (Screen Flows)
               → Stop / End element (Record-Triggered Flows)

Never connect a fault path back to the same element that faulted — this creates an infinite loop.

Step 5 — Automation Density Check

Before deploying, verify there are no overlapping automations on the same object and trigger event:

  • Other active Record-Triggered Flows on the same Object + When to Run combination
  • Legacy Process Builder rules still active on the same object
  • Workflow Rules that fire on the same field changes
  • Apex triggers that also run on the same before insert / after update context

Overlapping automations can cause unexpected ordering, recursion, and governor limit failures. Document the automation inventory for the object before activating.

Step 6 — Screen Flow UX Guidelines

…

常见问题

Salesforce 中的“流程”是什么?

它是一种可以自动完成重复性任务的工具,例如更新客户信息或发送邮件,无需编写代码。

为什么“循环中的 DML”是个问题?

在一列数据中反复执行某个操作(例如保存数据)非常缓慢,而且会消耗过多资源,可能导致系统崩溃。

什么是“故障连接器”?

它们是流程出错时所走的备用路径,让流程可以记录错误或友好地提示用户,而不是直接停止。

详情

作者的原始描述

Salesforce Flow architecture decisions, flow type selection, bulk safety validation, and fault handling standards. Use this skill when designing or reviewing Record-Triggered, Screen, Autolaunched, Scheduled, or Platform Event flows to ensure correct type selection, no DML/Get Records in loops, proper fault connectors on all data-changing elements, and appropriate automation density checks before

repo: github/awesome-copilot

热度

GitHub 星标
40k
排名
#7414
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能