Go Lightning Fast with Process Builder
Go Lightning Fast with Process Builder

Go Lightning Fast with Process Builder

03/16/2015 by Roger Mitchell
A deep dive into Lightning Process Builder with a few use cases, what it is, and what it isn’t!

Lightning Developer Week has passed us by a few days, but we can keep the energy going with a deep dive into Lightning Process Builder. Process Builder is another addition to the workflow automation features of the Salesforce platform, and it overlaps functions provided by Workflow Rules, Approval Processes, and Visual Workflow. Salesforce’s Trailhead site has a great table comparing these automation tools, and here’s the gist of when we recommend using Process Builder:

  • Centralize a complex set of if/then statements and their relevant actions; this usually requires multiple workflow rules to achieve
  • Perform actions not possible with workflow rules, like creating records (other than tasks), Chatter posts, calling Apex code, and updating any related parent and child records
  • More intuitive UI than Visual Workflow for building a set of steps and actions
  • Maintain version control over a given process, so you can see how it changes and revert back to previous processes

Process Builder sounds amazing based on the above points, but it does have some caveats. As the feature evolves, these gaps will likely be closed, but here are some reasons to use a more mature automation tool instead of Process Builder:

  • Approval Processes support being called by user clicks, Apex, and Visual Workflow; Process Builder only evaluates upon a record changing
  • Visual Workflow supports screen design to collect data and guide a user
  • Visual Workflow supports deletion of records
  • Workflow Rules can send outbound messages
  • Workflow Rules can have multiple time triggers

Let’s dive into our use cases, because these tools are already well documented and most requirements may have multiple solutions to produce the same result. Process Builder is already enabled for Spring ‘15 orgs, which means almost everyone reading this will be able to start building; navigating into Setup > Build > Create > Process Builder will launch the Process Builder home page, and we can create a new process or manage existing processes from this UI. 

Updating a Parent Record through Lookup Relationship

Now that we’re ready to go, let’s start with our first use case. Cross object workflow allows us to update fields on a parent record, but only via a master-detail relationship. Process Builder is relationship agnostic, and allows us to go across a lookup to update our parent record’s fields. Our contact Bruce Wayne has recently been reinstated as the CEO of Wayne Enterprises, and we want to ensure he is marked as the greatest influencer on the Account.

After updating Bruce’s contact to state he’s the “CEO and Chairman”, our process goes to update the account’s greatest influencer from Lucius Fox to Bruce Wayne. This is not possible to achieve with a workflow rule and field update, and our process was able to update a lookup field. This process is relatively simple, and involves one criteria step and a single action.

Meeting Notes to Chatter Group

Continuing on our road into new actions available to us with Process Builder, let’s go a little wild and do a more involved use case that leverages Chatter posts. Often times, salespeople will have meetings, and some of these results need to be highlighted to a group of people. Chatter posts are a great way to share this, especially since we can’t use email alerts with the Event object. Here’s a quick demo of logging a meeting, checking a box, and the post hitting our Chatter group “Noteworthy Meetings”.

This is another simple process, leveraging only one criteria step and a single action. With our post to Chatter option, we are able to post to a user, group, or on the record feed (if Chatter is enabled for that object). The editor allows us to merge in fields from our record and include that within the body post. Another great use for these is closed won notifications, and different criteria steps could determine which sales management group gets the post.

Pushing Household or Company Addresses Down to Contacts

Address management has a top down use case, where a firm or family moves and the address of the account will cause contact addresses to change as well. We typically encounter this use case, and previously would recommend the use of code to manage this, or a separate address object. Here’s a case where we change the mailing address for all of Wayne Enterprise’s contacts to 1 Market Street in San Francisco.

Instead of a screen clickthrough of the finished process, let’s take a look at how fast this can be accomplished from the My Processes page. Granted, I have spent some hands on time with Process Builder, but it takes 130 seconds to accomplish this, which is much less time than it would take to write the trigger and test class to do the same work.

Process Builder is a huge improvement to Salesforce’s declarative suite of tools, allowing admins and developers to post to Chatter, update parent records and multiple child records, create records (except for tasks, you still need workflow rules for those), and get into more complex workflow situations. These changes have some nuances and the tool will mature over each release to make it even more powerful; a high confidence prediction is that this tool may soon replace Visual Workflow by the Spring ‘16 release.

Do you have use cases or requirements that you can share, or chat more about Process Builder? Please feel free to leave comments and questions below, on our Facebook page, directly @RogerMitchell on Twitter, or in the Success Community!