Flow or Apex: When Does a Salesforce Admin Need a Developer?

Try the standard tools first. If a Flow solves the problem simply, clearly and reliably, there is no reason to write Apex. But if you are building a complicated Flow just to avoid writing code, it is probably time for Apex.

That is the rule I use, and it settles most of these arguments before they start.

What it does not say is “Flow or Apex”, because that framing is wrong. On the projects I work on the two sit together. Flow runs the process and the screens a person sees. Apex does the individual steps the Flow calls as actions. The question is never which one wins. It is which parts of this process belong in code.

Here are four cases from real projects, ordered from the clearest to the least clear. The last one is the one where I wrote Apex and probably did not need to.

The Flow that hit the CPU limit

A provider scheduling system. When someone was moved onto a new assignment, the Flow had to check that the new assignment carried every rate class the provider’s future shifts already used.

The Flow did this with two loops, one inside the other. The outer loop went through the rates on the new assignment, the inner loop through the scheduled events, and assignment elements built up a list of rate classes as a string.

That works fine for a provider with a handful of shifts. For a provider with a lot of them, the number of steps grows as one count times the other, and the Flow died on the CPU limit. This was not theoretical. The feature had already been pulled back off the main branch once.

I did not rewrite the Flow. The screens stayed. Choosing the assignment stayed. The rest of the process stayed. I moved one thing into Apex, the check itself.

The Apex version does two queries, puts the rate classes into a Set, and checks membership. It stops at the first rate it cannot find, because once one is missing the answer is already no. Out of the Flow came two loops, two record lookups and the assignment blocks that were building that string. In went one Apex action and one decision.

Two loops of clicking became one call and an answer.

Writing the action surfaced a second bug that had nothing to do with performance. On the Cancel path the new assignment id arrives empty, and an Apex action that declares that input as an Id falls over on deserialization before your code runs at all. Declaring it as a String and checking it yourself costs one line and saves a support ticket.

It went to production at the end of that month and it is still running there.

The thing Flow cannot do at all

On a grants application platform I built through DSG, applicants fill in a long application as a Flow, across several screens. At the end it has to come out as a PDF, for the applicant and for the reviewers who read it.

Flow cannot generate a PDF. That part is not a judgement call.

What you do about it is, and the first answer was not code. The org already had PDF Butler installed, a package built for this, with a template set up for the application back in 2024. It worked, up to a point. The applications are mostly rich text fields and people paste images into them, and handling that needed a helper action configured per field. About ten of them are still sitting in the org, one per question.

In April I wrote a generator instead. One Apex controller and a Visualforce page produce the PDF for every field, across all three objects that need one, and the per-field configuration went away.

The honest part: it is a partial replacement. The reviewer portal uses mine. Internally the old button still sits next to ours on the submission page and both work. Nobody turned the old one off, and there has been no reason to.

The thing the standard component cannot do

The same application takes file uploads, split into financial documents and supporting documents. Applicants come back to a part-finished application days later and need to see what they have already uploaded, separated by type.

The standard Flow File Upload component does not do that. It does not show files that are already on the record, and it has no concept of a document type to filter by.

What I did here is worth being precise about, because it is the normal case and people describe it badly. I did not write a file upload component. I took File Upload Improved, an open-source Flow screen component, and extended it: rendering the existing files, filtering them by type, and an Apex helper that reads the file links on the record and returns the right ones.

Tagging the uploads with their type is a separate step, and Flow could have done that one on its own with a loop. Apex was simply tidier next to the rest.

Checking whether someone has already built it is worth the twenty minutes it takes. It is the same habit as reaching for Flow before reaching for Apex, just applied earlier.

The one where I wrote Apex and did not have to

On that application there was a bug that lost people’s work.

An applicant writes their answers in Word, pastes them in, and the paste brings images with it. An image pasted into a rich text field does not arrive as an image. It arrives as a very long string of base64 text. The field blows past its limit, the save fails, and everything typed on that screen is gone. Salesforce allows up to 131,072 characters in a rich text field, but on this org those fields were set to 32,768, which is the length Salesforce offers by default when the field is created.

Flow cannot catch that failure cleanly, so the size has to be checked before the save rather than after it. I wrote an Apex action that checks the nine rich text fields against their limits and against a combined total, and returns a message naming the ones that are too long, so the applicant knows which box to fix.

Now the honest part. Flow could have done most of this. Nine formulas using LEN() and a decision element would have got there. It would have been clumsy, and assembling a useful message out of it would have been worse, but it would have worked. I chose Apex because it is cleaner, easier for the next person to maintain, and because I can write a test for it. It was not necessary.

If you asked me to justify custom development with this example, I could not do it honestly. I am including it because deciding well is not the same as deciding in favour of code.

So what do you actually ask?

Three questions, in this order.

Can the platform do it at all? A PDF, a screen that shows records in a layout no standard component offers, an integration that needs retries and real error handling. If the answer is no, the next question is whether somebody has already built it, in a package or an open-source component, and only then whether you write it yourself.

Does it fall over at volume? A Flow that works in testing and dies in production is usually looping over something that got bigger than anyone expected. Nested loops are the warning sign. The fix is rarely to rewrite the Flow. It is to find the one step that does not scale and move that step.

Am I building complexity just to avoid code? This is the one people get wrong in both directions. Nine formulas to avoid ten lines of Apex is one mistake. Writing Apex because it feels more professional than clicking is the other, and the second is more expensive, because every piece of code you write is a piece an admin can no longer change without you.

Most of what an Ops team needs is Flow, and a good admin gets a long way. You need a developer for the places where Flow runs out, and those places are specific enough to point at.

If you are looking at a Flow right now and cannot tell which side of that line it sits on, that is usually a sign worth taking seriously. The 2-minute quiz gives you a rough read on your org, or you can see how I work with Flow and automation and where custom development starts.

Emina Koćić, Salesforce Consultant · Virago. I've worked in Salesforce since 2020 and hold Platform Developer I, Platform Developer II and JavaScript Developer I certifications. I help Ops and RevOps teams with no developer get their Salesforce working again. Based in Tuzla, working with teams in Europe and North America. LinkedIn · Book a call

Not sure where your org stands?

Take the free 2-minute quiz, or book a call and we'll go through it together. No account managers, no handover to a junior.