The Decision - Flow or Code

The Decision - Flow or Code

Years ago, I spoke with a co-worker at Dreamforce. Our topic was popular – Clicks or Code – when to do something through Salesforce configuration or when to write the APEX code to accomplish meeting the requirements. Now the tables are turning, I find myself asking the question – Code or Flow. Salesforce Flow has become the wave of the future. Everyone jumps to Flow because it is “easily” maintainable by admins. But is the Flow always the right choice?

Don’t get me wrong, Flows meet the needs of many requirements. You can open Flow Builder and put together a matrix of elements. Screen flows meet the needs that lightning component modals provide. Dragging screen components takes seconds to write lines of HTML making the time to create a user-friendly screen faster. 

Record triggered Flows are probably the trickiest type of Flows. Recently I had to make the decision to use a Flow or write an APEX trigger. The requirement was to update a record, but I had to pull information from related objects – calculate a balance and concatenate codes. Also keep in mind the entry criteria were important. 

I started to go down the Flow path. As part of a delivery team, we are encouraged to use best practices. But I slowly ran into roadblocks and complications. How am I looping and capturing information? How do I only do it in specific cases? I knew in the back of my mind that it would take me half the time to write the trigger. Use a map, list then update – simple. I had to make the decision, keep trying to formulate my thoughts into the Flow matrix or write an APEX trigger that I could knock out in no time. So, I stopped and asked the key question – will the logic change? – No, will an admin maintain any updates to requirements moving forward? - No. Taking a deep breath – I decided to go down the APEX trigger path.

Flows will always be the first line of defense. Screen Flows has eliminated hours of frustration of styling a modal in a lightning component. But there are times were we still need the APEX code. Having the skill to know when to make the right decision of Code vs Flow has made me aware of my strengths. Requirements can take many paths, but making the right decision based on key clues on deciding between using a flow or APEX code makes for a better solution and a happy client.

To view or add a comment, sign in

Others also viewed

Explore content categories