How to Show Field History Track on Object

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

Last Updated on December 19, 2020 by

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 fi eld 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 Processwill 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.

How to Show Field History Track on Object

Source: https://automationchampion.com/2016/01/15/getting-started-with-process-builder-part-53-field-history-tracking-for-multi-select-picklist/

0 Response to "How to Show Field History Track on Object"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel