Answers to Salesforce Questions
salesforce data migration services
24
Aug

Why Use Processes instead of Workflows and Triggers?

Posted by : Shruti Sridharan

Since the introduction of Processes, the “clicks-no-code” in Salesforce has transitioned to a whole new level. Lately, Processes have become an Admin’s Best Friend. There used to be times when even for a small requirement, the administrator would have to run to a developer. Let us take a common use case – when the Billing Address on the Account changes, we need to update the Mailing Address on all the associated Contacts. Such instances would require the Admin to write an Apex Trigger. But gone are those times! Welcome – Lightning Processes. Think of Processes as “Workflows on Steroids” or at times I also call it “Workflows 2.0”. It comes with a humongous amount of possibilities. Instances such as the above could be met using Processes in hardly few minutes. Isn’t that awesome?!?

So, this blog post is not an instruction manual for “Processes” but I would primarily focus on “Why we Should Use Processes” instead of Workflows or Apex Triggers.

Why Processes?

Not everyone is capable of writing code. Processes were introduced for those who do not know to write code. Processes can do everything that a Workflow can do and even much more. Other than sending an Email Alert, Outbound Message, creating a Task or Updating a field of the same object which can be done with the help of Workflows, Processes can also do several other things like Running an Apex Class, Cross-Object Field Updates regardless of the type of Relationship, Creating a Record, Launching Flows etc. One of the things that I like the most is that since it avoids the use of Apex Triggers to an extent, we no longer have to go through the hassle of writing Apex and the associated Unit Tests! Isn’t that nice 😉

A Couple of Use Cases

Let us take a peek at some use cases that could be easily achieved using Processes which otherwise used to be a Developer’s dream!

  • Creating Records. When an Employee record has been created, create a record in the Interviewee object too. In other words, creating records in other objects.
  • Updating Parent Records. Updating parent records from the child even if they are related via a Lookup. We could do this with the Workflows too but we had a limitation of Master-Detail Lookup fields.
  • Achieving Complex Business Logic with Process and Flows. Finding the Region based on the Country – In most of the orgs, we would need an additional field on the Lead or Contact which would help us categorize the Lead/Contact to a region such as APAC (if the Country falls into the Asia-Pacific region), NA (if the Country falls into the North American region) so on and so forth. In most of the cases, people tackle this using Formula Fields but in certain cases, the Countries to which we sell or serve could be vast and the Formula Fields would be too restrictive to accommodate all the Countries. Thus the way to go would be to create a separate object called Country (think of it as a lookup table) which would house the Region information for every Country out there. Now we would use a Process together with a Flow to actually make the “Region” calculation possible without writing a single line of code. In other words, there will be a Process which would fire a Flow that would go and look for the Country record and grab the Region which would then be populated on the Lead or Contact.
  • Chatter Posts. Post a message into the Opportunity’s Chatter Feed when it is Closed/Won.
  • Trigger Approval Processes. Submit a Timesheet Record for Approval to your Manager.

Believe me, the list is endless and there are much more but these were a couple of them to get you inspired!

My Recent Musings

Recently, I came across an interesting use case – Imagine Michelle Gregory (Salesforce Administrator) working at The Stark Industries got a requirement from her VP asking her to clone the Opportunity Contact Roles of a closed Opportunity as Account Contact Roles i.e., whenever an Opportunity gets closed, all its Opportunity Contact Roles should be cloned as Account Contact Roles. Now the typical developer instinct in me got me thinking along the lines of writing an Apex Trigger to solve the need. But wait! I stopped and thought – Why not use a Process? And yes, I was able to do it and it worked like a charm. Here is a blog post explaining the same.

What are my next steps?

Well, if you have felt that awe in Processes, then don’t wait any longer! Check out the modules on Trailhead that could possibly feed the hunger in you.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments