Board scenario: your org has 40 triggers, 120 flows and 3 managed packages on Opportunity and Account, and saves take 8 seconds. Present your remediation plan.
Model answer
1. Measure before changing anything. Debug logs and the Apex Log Analyzer for representative saves; identify the costliest automation (CPU, SOQL, DML) and recursion. Check package triggers and their settings.
2. Consolidate per object.
- One Apex trigger per object through a trigger framework with ordered actions and bypasses.
- Merge flows: same-record field updates into before-save flows; consolidate after-save flows by entry criteria; retire Process Builder and workflow rules.
- Agree ownership rules for Flow vs Apex per object.
3. Remove waste. Recursion (track processed records per event), unnecessary queries (selectors with only needed fields), DML on records that didn't change, and duplicate logic between packages and custom code.
4. Move work out of the save. Callouts, roll-ups that can lag, notifications and integrations go async (Queueable, platform events, scheduled paths in flows).
5. Data and sharing. Account data skew (too many child records per account) and ownership skew make saves lock and recalculate sharing; fix the data model or ownership.
6. Governance. A design authority for new automation on core objects, performance budgets (for example a CPU budget per save), and performance tests in CI with bulk data.
7. Phasing. Quick wins (recursion, async moves) in weeks; consolidation object by object; measure after each phase and report the save time.
โ Key points to hit
โ Red-flag answers
- Rewriting everything in one go
- Blaming managed packages without evidence
- No measurement before and after
โช Follow-ups
How do you handle managed package triggers you can't change?
Measure their cost, check the package's settings to disable unused features, ask the vendor about bulk behaviour, and make sure your automation doesn't trigger them unnecessarily (for example by avoiding no-op updates).
What target would you set?
A measurable save-time and CPU budget for typical and bulk saves, agreed with the business (for example under 2 seconds for a single opportunity save), tracked in performance tests.