Skip to content

Repository files navigation

savepath

What really runs when a Salesforce record is saved.

Every org grows its own tangle: a before-save flow here, a trigger from a package there, three validation rules, a workflow field update that quietly fires the triggers a second time, a roll-up that saves the parent account and starts it all again. When a save is slow, fails with a validation error nobody wrote, or updates a field "by itself", the first question is always the same: what runs, and in what order?

savepath answers it from the org's own metadata and, when you have one, from a debug log.

the order of execution for Opportunity update

sf CLI plugin

sf plugins install @illinifellow/plugin-savepath
sf savepath explain --sobject Opportunity --operation update --target-org prod
sf savepath replay --log ./logs/07L5g00000ABcDe.log --slowest 10

explain lists every active flow, trigger, validation rule, duplicate rule and workflow rule in the step where Salesforce runs it, and warns when record-triggered flows have no trigger order. replay turns a debug log into a timeline of units with duration, SOQL and DML per unit, and the limits used.

In the org

force-app/ is an unlocked package with a Lightning app page: pick an object and an operation and see the same timeline, with inactive automation greyed out. The Tooling API is called from Apex through a Named Credential; nothing leaves the org.

Why the order matters

Salesforce documents it in Triggers and Order of Execution in the Apex Developer Guide. savepath follows that page step by step, including the parts people forget: workflow field updates re-running before and after triggers once more, and roll-up summaries sending the parent record through its own save.

Credits

  • The order of execution is Salesforce's own documentation; savepath only makes it concrete for your org.
  • Apex debug log line formats as documented in the Apex Developer Guide.
  • Built on @salesforce/sf-plugins-core and oclif.

License

BSD-3-Clause, like the sf CLI plugins it sits beside.

About

See what really runs when a Salesforce record is saved: flows, triggers, rules and limits, in execution order. sf CLI plugin + Lightning app.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages