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

29 lines
743 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Trigger Framework"
type: concept
tags: [salesforce, triggers, architecture]
sources: [specialized-salesforce-architect.md]
last_updated: 2026-04-20
---
# Trigger Framework
Salesforce 触发器的标准化架构模式。
## 核心原则
- 每个对象一个触发器
- 触发器不包含业务逻辑,只委托给 handler 类
- 必须支持批量处理Bulkification
## 架构组成
1. **Trigger** — 入口点,只做委托
2. **Handler** — 包含业务逻辑
3. **Selector** — SOQL 查询封装
4. **Service** — 跨触发器共享逻辑
## 关键规则
- 无业务逻辑放在触发器中
- 委托给 handler 类处理所有业务逻辑
## 相关概念
- [[Bulkification]] — 触发器必须支持批量处理