When should I use Apex instead of flows?
Visual flows become harder to test than a code service once they involve loops, cross-object branches, or bulk behavior. Starting with a flow often forces you to introduce code anyway, leaving you managing conflicting triggering mechanisms that create ongoing issues for long-term maintenance.
Core Friction Pattern
Analysis of 5 peer accounts across online developer and community forums reveals that “When should I use Apex instead of flows?” repeatedly surfaces due to edge-case mismatches between standard defaults and real-world environments. Standard troubleshooting frequently falls short, compelling practitioners to develop custom workarounds.
+5 alternative community-tested workarounds cataloged below.
What the numbers show
Counted from the threads quoted below. How we count
- People have been saying this in most months since September 2026.
- This comes up 103.9× more often in r/salesforce than across the site as a whole.
What people tried
Every workaround mentioned in the threads below. We haven’t tested any of them — and nobody here is claiming they worked.
Found another way around this?
Share your steps and trade-offs so fellow engineers don't have to reinvent the wheel. No account required.
When should I use Apex instead of flows?
- 1Using Flow until performance or testing limits are hit and then switching to ApexDid this help you?
- 2Relying on team skill sets (admins vs developers) to dictate the automation choiceDid this help you?
- 3Leveraging AI coding assistants to write code faster instead of building complex visual workflowsDid this help you?
- 4Using whatever styling method one is most comfortable withDid this help you?
- 5Splitting changes by type, putting site-wide styles in global settings or a single CSS fileDid this help you?
- 6Putting custom code in one place like a child theme or customizerDid this help you?
In their words
Unedited, grouped by where they were said, most upvoted first within each place, each linked to the thread it came from.
“once a flow has several loops, cross-object branches, or needs careful bulk behavior, it starts feeling harder to test than a small Apex service.”source ↗
“This is a good question. Still wrestle with it now.”source ↗
“whenever you start with triggered flow, inevitably you find reasons you need apex. Then all of a sudden you are managing different triggering mechanisms and trying to make them play nice, which often leads to issues.”source ↗
Where this came up
People with this problem also raised
- 2Buy once cry once or start with cheaper equipment?
- 6Are later steps in lawn care programs actually necessary?
- 2How do I switch from old sysadmin stuff to IaC?
- 3Is premium gas actually necessary if my car recommends it?
- 3How to streamline Intune security policies across multiple tenants
- 12How do you manage DCIM and IPAM data in a GitOps workflow?