Sub topic 1
The Salesforce Automation Toolbox at a Glance
Prerequisites
You should know Salesforce objects, fields, records, and basic relationships. You should also understand that automation runs when data changes or when a user starts a guided process.
The toolbox
Salesforce provides several automation tools. Choose the simplest tool that meets the requirement.
| Tool | Best fit |
|---|---|
| Validation rule | Stop a record that does not meet a condition |
| Formula field | Calculate a value when someone views a record |
| Roll-up summary field | Summarize child records on a master record |
| Flow | Update records, guide users, or run scheduled work |
| Approval process | Route a record for formal approval |
| Apex | Handle complex logic or limits that declarative tools cannot handle |
Clicks before code
Start with configuration, often called the “clicks-before-code” approach. First check whether a validation rule, formula, roll-up summary field, or Flow can solve the requirement. Use Apex only when the requirement needs code, complex processing, or a volume that Flow cannot handle safely.
This approach reduces maintenance. Administrators can usually inspect and change declarative automation more easily than custom code.
When basic declarative tools are enough
Use a validation rule when the system must reject invalid data, such as an opportunity with a close date before today.
Use a formula field for a value calculated from existing data. A formula does not store a separate value. Salesforce calculates it when the record is read.
Use a roll-up summary field when a master record needs a count, sum, minimum, or maximum from related detail records. Roll-ups require a supported master-detail relationship.
Flow Builder and flow types
Flow Builder is Salesforce’s general-purpose declarative automation tool. A flow contains elements such as decisions, assignments, record queries, and record updates.
Common flow types include:
- Record-triggered flows, started by creating or updating a record.
- Screen flows, which guide a user through questions and actions.
- Scheduled flows, which process records at a specified time.
- Autolaunched flows, started by another automation, button, or Apex.
Record-triggered flows
A before-save flow changes fields on the record that triggered it. It is efficient because it avoids a separate database update.
An after-save flow runs after the record is saved. Use it when you must update related records, create records, send notifications, or call another action.
Exercise
A Case update must set a field on the same Case only. Which flow type should you choose?
Show answer
Choose a before-save record-triggered flow.