We often want to do some if-this/then-that automation in Salesforce. But Salesforce gives you many ways to build automation, both declaratively (clicks, not code!) and programmatically: Workflow Rules, Process Builder, Apex, and Flow. This post goes through the pros/cons of each (but spoiler, just use Flow).
>> Related: How to Re-run Lead Assignment Rules Using Flows & Apex <<
What are Salesforce Workflow Rules?
Workflow Rules are quite simple. You set Conditions and then once conditions are matched, you do Actions, whether that’s a field update or creating a task or sending an email alert.
- They’re very fast and easy to configure, and so they’re very popular. ✅
- But you can’t (usually) create rules across objects. An example of that would be “if a Contact does This, I want to do Something to the Account.” ❌
What is Salesforce Apex?
On the opposite end of the spectrum is Apex. Apex is a programming language that allows developers to enhance Salesforce with custom code. This usually takes the form of Apex Triggers and/or Apex Classes.
- Sky is the limit in terms of functionality and speed. ✅
- This is not a common skill among Salesforce Admins and requires development expertise. ❌
What is Salesforce Process Builder?
Because Workflow Rules are so limited (and Apex so intimidating) Salesforce released Process Builder.
- Process Builder is also point-and-click, and any admin can use it. ✅
- It has a little more power and can go cross-object. ✅
- But it’s slow. ❌
- And it’s not well-suited to complex logic. ❌
Which brings us to Salesforce Flow
Flow is similar to Process Builder, but better in almost every way. (Indeed Process Builder was created on the Flow engine! If you ever try to deploy a process through a Change Set or query for one, you’ll notice they live under the “Flow Definition” section.)
- Flow gives you a lot more interesting options and configurations. The winter ’20 release included record-triggered Flows, which unlocked so much more declarative power. ✅
- Flow is almost as fast as Apex for same-object field updates (~90% of all declarative automation across Salesforce orgs), but it’s still point-and-click and very Admin-friendly. ✅
- Of course it’s not quite as powerful as writing your own code in Apex, but with Flow, there are now very few use cases where you need to resort to writing your own code.
Flow is also where Salesforce is investing. On Sep 23, 2021, Salesforce announced they’re deprecating Workflow Rules and Process Builder within the next couple of years (timeline still TBD) And they cautioned, “the best way for you to future-proof your organization is to move your automation to Flow.” Message received.
So if you’re creating new automations in Salesforce, always start with Flow, and then resort to Apex if you must.
Ready to unleash the full power of Salesforce, without hiring another full time employee?
Learn about our Salesforce admin support package.