Getting Started with Process Builder – Part 53 (Field History Tracking for Multi-Select Picklist)

Getting Started with Process Builder – Part 53 (Field History Tracking for Multi-Select Picklist)

Last Updated on December 19, 2020 by Rakesh Gupta

To understand how to solve the same business use case using Salesforce Flow. Check out this article Getting Started with Salesforce Flow – Part 33 (Prior Value of a Record in Record-Triggered Flows).

Big Idea or Enduring Question:

  • How do you track what has been changed on a Multi-Select picklist? 

Tracking field history is an out-of-the-box feature to track value changes in a field. You can select certain fields to track and display the field history in the History related list of an object. The field history data is retained for up to 18 months. Note that the Long text area, Rich text area, and Multi-select Picklist fields are tracked as edited, but their old and new field values are not captured when the record is updated. History tracking capture the following information:

  • Prior value 
  • Current value
  • Who has done the changes
  • When it was changed

Objectives:

After reading this blog, you’ll be able to: 

  • Understand how to track field value changes for Multi-select picklist
  • Learn how to create a record from the Process Builder

Business Use Case

Pamela Kline is working as a System administrator at Universal Containers (UC). She has received a requirement to enable field history tracking for multi-select picklist (Country) on the Lead object, also capture country old and new values.

Country - Multi-select picklist

Automation Champion Approach (I-do):

There are multiple ways to solve the above business requirement. You can either use Apex trigger, Combination of Flow & Process Builder, and more. To solve this requirement, we will use the Process Builder

There are four basic components that should be considered when using Process Builder —  a trigger, criteria, immediate action, and scheduled action.

Component Process
Trigger Indicates when the action should fire – only when a record is created or anytime a record is created or edited
Criteria Set conditions to execute the process
Immediate Action The action is fired immediately
Scheduled Action The action is fired at a scheduled time

Before diving further, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes to go through the following Flow diagram and understand it.

Let’s begin building this automation process.

Guided Practice (We-do):

There are 6 steps to solve Pamela’s business requirement using Process Builder. We must:

  1. Create a Multi-select picklist
  2. Create a custom object that will be used to store old and new values of the multi-select picklist 
  3. Define process properties
  4. Define evaluation criteria
  5. Define process criteria
  6. Add action – create a record 

Step 1: Creating a Custom Multi-select Picklist Country on Lead Object 

On the Lead object, create a lookup field called Country as mentioned in the steps below. 

  1. Click Setup.
  2. In the Object Manager, type Lead.
  3. Select Fields & Relationships, then click New.
  4. Select Picklist (Multi-select) as Data Type, then click Next.
  5. Enter Field Label and click the Next button. The API Name will populate. 
  6. As a best practice, always input a description
  7. Set the Field-level Security for the profiles, make sure to grant field access profiles. 
  8. Add this field to Page Layout.
  9. Click Save.

Step 2: Create a Custom Object 

The next step is to create a custom object Country History Tracking and a few custom fields to store related information which will use to store old and new values of country multi-select picklist. 

  1. Click Setup.
  2. In the Object Manager, click Create | Custom Object.
  3. Now create a custom object Country History Tracking and fields as shown in the screenshot below: 
  4. Click Save.
  5. Set the object security and setting as mentioned below: 
    1. Organization-Wide Defaults: – Public Read Only
    2. Field-level Security: – View
    3. Object-level Permission: – Read
    4. Remove Edit and Del button from the page layout

Step 3: Define Process Properties

  1. Click Setup.
  2. In the Quick Find box, type Process Builder.
  3. Select Process Builder, then click New.
  4. Name the Process and click the Tab button. The API Name will populate. 
  5. As a best practice, always input a description
  6. The process starts when A record changes.
  7. Click Save.

Step 4: Define Evaluation Criteria

  1. Click on the Add Object node to begin selecting the evaluation criteria.
  2. Select the Lead object from the dropdown list.
  3. Start the process when a record is created or edited.
  4. Click Save.

Step 5: Define Process Criteria

  1. Click the Add Criteria node to begin defining the process criteria.
  2. Name the criteria.
  3. The criteria should execute actions when the conditions are met.
  4. Set Conditions
    1. Row 1
      1. Field: Lead | Country__c
      2. Operator: Is Changed
      3. Type: Boolean
      4. Value: True
  5. Select All of the conditions are met (AND)
  6. Click Save.

Step 6: Add Action – Create a Record

  1. Below Immediate Actions, click Add Action.
  2. For Action Type, select Create a Record
  3. Name the action.
  4. Select the Country History Tracking record type. 
  5. Set Field Values:
    1. Row 1:
      1. Field: Owner ID
      2. Type: Field Reference
      3. Value: Lead | LastModifiedById
    2. Click Add Row
    3. Row 2:
      1. Field: Action
      2. Type: Formula
      3. Value: ‘Changed’ & ‘ ‘&’from’ &’ ‘& PRIORVALUE([Lead].rakeshistomMVP__Country__c ) & ‘ ‘&’to’ & ‘ ‘&IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “India”), “India; “,””) &IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “USA”), “USA; “, “”)&
        IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “UK”), “UK; “, “”) &
        IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “France”), “France; “, “”) &
        IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “Russia”), “Russia; “, “”)
    4. Click Add Row
    5. Row 3:
      1. Field: Changed By
      2. Type: Field Reference
      3. Value: Lead | LastModifiedById
    6. Click Add Row
    7. Row 4:
      1. Field: Change Date Time
      2. Type: Field Reference
      3. Value: Lead | LastModifiedDate
    8. Click Add Row
    9. Row 4:
      1. Field: Lead
      2. Type: Field Reference
      3. Value: Lead | ID
  6. Click Save.


In the end, Pamela’s Process will look like the following screenshot:

Almost there! Once everything looks good, click the Activate button. 

Proof of Concept

Formative Assessment:

I want to hear from you!  

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? 

Let me know by Tweeting me at @automationchamp, or find me on LinkedIn.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

6 thoughts on “Getting Started with Process Builder – Part 53 (Field History Tracking for Multi-Select Picklist)

  1. Please help.

    showing syntax error.

    ‘Changed’ & ‘ ‘&’from’ &’ ‘& PRIORVALUE([Lead].Countries__c ) & ‘ ‘&’to’ & ‘ ‘&
    IF( INCLUDES([Lead].Countries__c , “India”), “India; “,””) &
    IF( INCLUDES([Lead].Countries__c , “US”), “US; “, “”)&
    IF( INCLUDES([Lead].Countries__c , “UK”), “UK; “, “”) &
    IF( INCLUDES([Lead].Countries__c , “Japan”), “Japan; “, “”) &
    IF( INCLUDES([Lead].Countries__c , “Singapore”), “Singapore; “, “”) &
    IF( INCLUDES([Lead].Countries__c , “Spain”), “Spain; “, “”) &
    IF( INCLUDES([Lead].Countries__c , “Srilanka”), “Srilanka; “, “”)

    1. Try this

      ‘Changed’ & ‘ ‘&’from’ &’ ‘& PRIORVALUE([Lead].rakeshistomMVP__Country__c ) & ‘ ‘&’to’ & ‘ ‘&IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “India”), “India; “,””) &IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “USA”), “USA; “, “”)&
      IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “UK”), “UK; “, “”) &
      IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “France”), “France; “, “”) &
      IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “Russia”), “Russia; “, “”) &
      IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “Spain”), “Spain; “, “”) &
      IF( INCLUDES([Lead].rakeshistomMVP__Country__c , “Srilanka”), “Srilanka; “, “”)

  2. Hi Rakesh,
    Thanks for your wonderful blog. I learned a lot from you. Everything I know about Visual workflow is from your book.

    I do have a quick question that was not addressed in your book. Maybe you could write a post about it, since I have searched for day and I could not find any definite information.

    I have an autolaunched flow on Opportunity LineItem (Opportunity Product) that perfoms some calculation to determine how the sales person will be compensated at the line item level (we have a complex product heirachy). My flow works perfectly when a single record Opportunity Product record is added to the opportunity. However when you add multiple Opp Products at one time, only the first record on the list is calculated correctly. Do you have any hints for me. Even a oneliner will help.

    Overall please blog more about auto-launched flow and the interaction with process builder.

    1. Thank you so much 🙂

      Seems like you are using SObject variable to pass the record details from Process Builder to Flow, I will suggest you to use SObject Collection variable and let me know how it goes.

  3. Hi Rakesh, first of all: I truly, deeply love your process blogs. They are extremely helpful and inspiring. I tried to replicate this one but I just can’t get the formula to work. It constantly complains that a comma is missing. I wonder if you can help me? Do you see anything obvious in the expression below?
    ‘Changed’ & ” ” & “from” & ” ” & PRIORVALUE ([Contact].NewSubjectArea__c) & ” ” & “to” & ” ‘” &
    IF(INCLUDES([Contact].NewSubjectArea__c), “Architecture and Design”),”Architecture and Design; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Area Studies”),”Area Studies; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Arts”),”Arts; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Chemistry”),”Chemistry; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “ClassicalAndAncientNearEasternStudies”),”ClassicalAndAncientNearEasternStudies; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Computer Sciences”),”Computer Sciences; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Economics”), “Economics; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Engineering”),”Engineering; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Geosciences”),”Geosciences; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “History”),”History; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Industrial Chemistry”),”Industrial Chemistry ;”,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Jewish Studies”),”Jewish Studies; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Law”),”Law; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Library & Inform. Science, Book Studies”),”Library & Inform. Science, Book Studies; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Life Sciences”),”Life Sciences; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Linguistics and Semiotics”),”Linguistics and Semiotics; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Literary Studies”),”Literary Studies; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Materials Sciences”),”Materials Sciences; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Mathematics”),”Mathematics; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Medicine”),”Medicine; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Music”),”Music; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Pharmacy”),”Pharmacy; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Philosophy”),”Philosophy; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Physics”),”Physics; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Social Sciences”),”Social Sciences; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Sports and Recreation”),”Sports and Recreation; “,””)&
    IF(INCLUDES([Contact].NewSubjectArea__c), “Theology and Religious Studies”),”Theology and Religious Studies; “,””)
    I built this one in in Word and I had the issue before that copying and pasting from Word to Salesforce gave an issue because of quotation marks. But still – I can’t see where the error is.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.