How To

Process Builder – Sales Cloud Use Case

You may have heard, Process Builder is an #AwesomeAdmin’s Swiss Army Knife. Why, you ask? Process builder allows Administrators the ability to chain individual process events together, eliminating the need for the multiple workflow rules we’re all used to, with immediate and scheduled actions, all in one place. In some cases, process builder can eliminate the need to write custom code to automate processes. Administrators can make enhancements to automated processes with point-and-click efficiency, making them less dependent on their developer counterparts, to implement more out-of-the-box solutions. We can stop using apex code to automate simple tasks, which means no test coverage needed. Hooray!

With Process Builder, you can:

  • Create a record
  • Update any related record, not just the record or its parent
  • Post to chatter on the record, to a chatter group or user
  • Use a quick action to create or update a record or log a call
  • Submit a record for approval
  • Autolaunch a visual workflow
  • Send an email
  • Call apex code

There are some limitations with process builder that you should be aware of. Visit Help & Training. To understand how to troubleshoot process builder, read the article in Help & Training.

Here are a few lessons learned from implementing this use case:

  • Process builder is a great tool for administrators, allowing you to automate/consolidate processes rather than work through/troubleshoot a long list of workflow rules. Also, it eliminates the need to touch apex code to automate simple tasks. Less code, more out-of-the-box Salesforce declarative solutions.
  • Provide descriptions, where provided, in Salesforce. This may be tedious step, I know, but your future self will thank you when you are trying to remember what you configured or assist other/future admins when troubleshooting or enhancing what was built. This includes noting the data stored in a custom field, providing the purpose of a process builder, etc.

Business Use Case: Addison Dogster is a system administrator at Universal Containers. Sammy Sunshine is the Director of Sales. He would like to improve the opportunity process as it relates to opportunities that are closed won. When an opportunity is marked closed won, Universal Containers would like to post this event to the existing Sales News chatter group for recognition purposes. Sammy notices that his Sales Reps are not updating the opportunity’s closed date to the date the opportunity was closed won. He would like this corrected. On the account record, Sammy would like to see information about the most recent opportunity closed won. Additionally, Sammy would like to automate the submission of the closed won opportunity to Finance for approval before the transaction is turned into a sale. Currently, the team remembers to do this manually half the time.

Solution: Addison is able to solve this declaratively by creating a custom account field to store information for the last opportunity closed won and process builder to post to Sales News chatter group, update the opportunity’s closed date to today’s date, update the last opportunity closed won field on the account and submit the opportunity for Finance’s approval.

Note: For this use case, the Sales News chatter group and the opportunity approval process to Finance already existed in the org. We will not be covering how to configure those in this blog post.  


Quick Steps:

This assumes that you have already created a Sales News chatter group and an opportunity approval process for Finance approval in your Salesforce org.

  1. Create a custom account field (Customize | Accounts | Fields) called Last Opportunity Closed Won. The FLS should be set to be visible and editable by the System Administrator and visible to the Sales Rep. Edit the Account page layout to move the field to the desired location on the page. Also, this field should be marked as Read Only on the page layout so users can’t just go and modify the field.


Best practice tips:

  • Don’t forget to provide a description so you and other/future admins know what this custom field is used for.
  • Set the FLS (field level security) for each profile. Only make the field visible and visible/editable for the profiles that need it. Do not just click the “Next” button when you are on the screen.
  • Only add the new field to the necessary page layout(s).

2. Create a process builder (Create | Workflows & Approvals | Process Builder). Click on the New button.


A. Create a new process. Give it a name, description and click on the “Save” button.


B. Specify Opportunity as the object, select “when a record is created or edited” and click on the “Save” button.


C. For the node criteria, provide a criteria name. We’re going to call it “Opp Closed Won”. Specify as the criteria for executing actions as “Conditions are met”. We want this criteria to execute if the opportunity stage as “Closed Won.”

Click within the Field box in the Set Conditions box. Start typing “Stage”. As you start typing, you will notice that the system will start filtering the fields.


Select “Stage” as the Opportunity field and click on the “Choose” button.


Keep the operator as “equals” and select “Closed Won: from the value picklist. Then, for conditions, leave it as is, set to “All of the conditions are met (AND).


Under Advanced, check “Yes” so that the actions will only execute when specific changes are made to the record. Click on the “Save” button.

This is the end result…


D. Add the first immediate action, we will select as “Post to Chatter” as the Action Type. Give it an action name. We will call ours “Post to Sales News.” Next, we will select to post this to a Chatter Group. Start typing the group name in the group field. This will return chatter groups that match. Here, we will select “Sales News.”


In the Message box, you can start using the Merge Field to locate fields you want to use in your chatter message. We want to chatter message to look like this:

Congrats to {![Opportunity].Owner.FirstName} {![Opportunity].Owner.LastName} for closing an opportunity of ${![Opportunity].Amount} for {![Opportunity].Account.Name}!


Click the “Save” button.

E. Select “Update Records” as the Action Name. Provide an action name. We will call it “Update Opp Closed Date.” For the Record Type, choose “Select the Opportunity record that started your process” and click on the “Choose” button.


F. For criteria for updating records, select “No criteria—just update the records!” Then select as the criteria, select “Closed Date” for the field. Select “Formula” as the type. This will open up the formula box. Enter “ TODAY()” and click on the “Use this Formula” button. Then click on the “Save” button.


Here is the end result…


G. Select “Update Records” as the Action Name. Provide an action name. We will call it “Update the account.” For the Record Type, choose “Select a record related to the Opportunity”, start typing “Account ID”. Select “Account ID” and click on the “Choose” button.  


H. For criteria for updating records, select “No criteria—just update the records!” Then select as the criteria, select “Last Opportunity Closed Won” for the field. Select “Formula” as the type. This will open up the formula box.


[Opportunity].Name & “- $” & TEXT([Opportunity].Amount) & “-” &  
Text ( MONTH( today() )) & “/” &
text(DAY( today() )) & “/” &
Text(YEAR( Today() ))  

Click on the “Use this Formula” button.


Then click on the “Save” button.

The end result looks like this…


I. For our last immediate action, select “Submit for Approval” as the action type. Provide an action name. We will call it “Finance Approval”. Under the Approval Process, select “Specific approval process”. Note: The FinanceApproval process already existed in the org. This is the approval process we want to execute. So, in the approval box, start typing the name of the approval process. The system will show results that meet the approval process name as soon as it finds a match. Select the approval process. We will leave the submitter as the “Current User”. Click on the “Save” button.


J. Click the Activate button in the upper right hand corner. You will see the pop up below. Click the “Ok” button.


That’s it. Congrats, you’ve implemented the solution!

Now, before you deploy the changes to Production, you need to test your configuration changes.

  1. Create an opportunity associated to an account.
  2. Update the opportunity status to “Closed Won.”
  3. Confirm the following:
    • A chatter post is added to the Sales News chatter group:

Congrats to {![Opportunity].Owner.FirstName} {![Opportunity].Owner.LastName} for closing an opportunity of ${![Opportunity].Amount} for {![Opportunity].Account.Name}!

    • The opportunity’s close date is today’s date.
    • On the opportunity’s account record, the Last Opportunity Closed Won shows [Opportunity].Name([Opportunity].Amount)-mm/dd/yyyy
    • The opportunity has been submitted for the finance approval process for the opportunity object.


Deployment Notes/Tips:

  • The custom account field and process builder can be deployed to Production in a change set.
  • The field level security for the custom account field will need to be manually updated post deployment. I would caution against adding the related profiles in the changeset for deployment as the results of deploying a profile are not reliable. If you have a tool like Snapshot by Dreamfactory, you can use the tool to deploy field permissions.
  • You will find the process builder component in a change set under the Flow Definition component type.
  • Activate the process builder after it is deployed in Production as process builders are deployed as inactive.