Files
nexus/wiki/concepts/Bulkification.md
2026-04-21 00:02:55 +08:00

766 B

title, type, tags, sources, last_updated
title type tags sources last_updated
Bulkification concept
salesforce
triggers
best-practices
specialized-salesforce-architect.md
2026-04-20

Bulkification

Salesforce 触发器必须能够批量处理多条记录的机制。

要求

  • 触发器逻辑绝不能一次只处理一条记录
  • 代码必须能在 200 条记录的批量操作下正常工作
  • 如果代码在 200 条记录时会失败,则视为错误

实现方式

  • 使用 Maps 存储数据
  • 避免在循环中执行 SOQL 或 DML
  • 使用 Sets 和 Lists 批量操作

相关概念

来源

Salesforce-Architect 智能体的核心设计原则