back to blog
MANAGE LEAD RATING PROCESS IN SALESFORCE
August 18 2023 • 5 min read

BUSINESS CHALLENGE

Leads are rated based on the activity that happens with that lead. Normally, this is a field (Rating field - Value HOT, WARM and COLD) which is manually updated by the user based on the activity.

The requirement here is to update the Rating on the lead automatically based on the activity (Task, email, chatter etc). 

This can be achieved in by two approaches in salesforce:

  1. Creating a Formula field
  2. Building a Flow

Let’s have a look at how to achieve this.

STEPS TO ACHIEVE THE REQUIREMENT

CREATE  FORMULA FIELD

  1. From the home screen click  on the gear icon at the top–Go  to set up.

arl 1 1

  1. Select object manager→ In the Quick find search and select Lead.

arl 2

  1. Select  Fields and Relationships → Click New.

arl 3

  1. Select Formula → Click Next.

arl 4

  1. Enter Rating as the field label → Field Name(API Name) will be populated automatically.

arl 5

  1. Formula return type click as TEXT→ Click Next.
  2. Below Formula returns the Derived Rating.
IF( NOW() - CreatedDate < 30, "Hot",
    IF( NOW() - CreatedDate < 60, "Warm","Cold" )
)

arl 6 1

  1. Click Next.

This is one way of creating Ratings on Lead. Let's look at the other way.

CREATE FLOW

  1. From the Quick find search and select Flows → Click New Flow.

arl 7

  1. Select Schedule Triggered Flow  → Click Create.

arl 8

  1. By default the layout is set to Auto Layout.
  2. Select (+) icon → Select Get Records Element.

get record

  1. Enter Get records 30 days or older as the Label. Select Object as Lead → Choose All Conditions Are Met (AND) for the condition requirements.

arl 10

  1. For the first condition choose Field as CreatedDate, Less than or equal as operator and value as date30daysorequal → Add another condition as Rating Does Not Equal Cold.

arl 11

  1. Under Sort Lead Records choose All Records to store, select Choose fields and let salesforce do the rest for How to Store Record Data.
  2. For Select Lead Fields to store in Variable add ID, Rating, Created Date.
  3. Click Done.

arl 12

  1. Click (+) icon → Select Loop Element.

loop2

  1. Enter Loop records as Label API Name will be auto populated.
  2. Select Collection variable as {!Get_records_30_days_or_older}.
  3. Select Direction as First item to last item.
  4. Click Done.

arl 14

  1. Select (+) icon → Select Decision Element.

arl 15

  1. Enter Label as Verify duration of the lead.
  2. Outcome Details as 60 days or older API Name will be auto populated →All conditions Are Met(AND).
  3. Enter Resource as Current item from loop loop_lead_records>created date Less than or EqualX 60daysorolder.
  4. Click Done.

arl 16

  1. Select (+) icon → Select Assignment Element.

arl 17

  1. Set Label as set rating to cold API Name will be auto populated

  2. Set Variable values as 

    Currentlead > Lead ID Equals to current item from loop loop_lead_Records>Lead ID

    Currentlead > Rating Equals to Cold

    Leadstoupdatecollection add to Current Lead

  3. Click Done.

cold

  1. Select (+) icon → Select Assignment Element.

arl 19

  1. Set Label as set rating to warm API Name will be auto populated.

  2. Set Variable values as

    Currentlead > Lead ID Equals to current item from loop loop_lead_Records>Lead ID

    Currentlead > Rating Equals to Warm

    Leadstoupdatecollection add to Current Lead

  3. Click Done.

arl 18

  1. Select (+) icon → Select Assignment Element.

arl 19

  1. Set Label as Get the collection count  API Name will be auto populated.

  2. Set Variable values as

    Collection Count Equal count to lead to leads update collection

  3. Click Done.

arl 20

  1. Select (+) icon → Select Decision Element.

arl 21

  1. Enter Label as verify collection count API Name will be auto populated.
  2. Outcome details Label as Collection greater than 0 API Name will be auto populated.
  3. Select condition requirements to All Conditions Are Met(AND).
  4. Select Resource to Collectioncount Greater than 0.
  5. Click Done.

arl 22

  1. Select (+) icon → Select Update Records Element.

arl 23

  1. Enter Label As Update collection API Name will be auto populated.
  2. Select Use the IDs and all field values from a record or record collection.
  3. Select  Records to update as leadstoupdatecollection.
  4. Click Done.

arl 24

  1. Save the Flow activate it.

WRAPPING IT UP

In this blog we have covered how to manage Ratings on Lead object  using Formula or Flow.

Leave a Comment

Your email address will not be published

© 2024 Digital Biz Tech