Automation Champion

Automating Salesforce One Click at a Time
Automation Champion
  • Home
  • About Me
    • Testimonials
    • Resources
  • Process Builder
  • Salesforce Flow
  • Pardot
  • Apex
  • Training Details
    • Salesforce Administrator
    • Salesforce Advanced Administrator
    • Platform App Builder
    • Lightning Flow
    • Pardot
    • Sales Cloud
    • Service Cloud
    • Community Cloud
    • Hands-on Excercises
  • My Books
  • Contact Me
  • Tag: Work.com examples with PB

    • Getting Started with Process Builder – Part 12 (Implement Gamification to Your Salesforce)

      Posted at 1:38 AM by Rakesh Gupta, on December 21, 2020

      Big Idea or Enduring Question:

      How can I use gamification in Salesforce to drive sales?  What are the ways to automate the gamification?

      Objectives:

      After reading this blog post, the reader will be able to:

      • Create a flow that will automatically post a badge
      • Trigger a Flow via Process Builder
      • Automatically post to Chatter

      Business Use case

      Martin Jones is working as a System administrator at Universal Containers (UC). His organization wants to implement gamification to help boost the sales pipeline. He received a requirement from his manager if an Opportunity is closed within 7 days of its creation do the following:

      • Give a Deal Maker badge to the Opportunity Owner from SVP of Sales & Marketing  (i.e. Tushar Gupta)
      • Post this info on the Opportunity Owner’s Chatter profile (see screenshot)

      Gamification in Salesforce

      Automation Champion Approach (I-do):

      Gamification is the use of game mechanics (challenges, competition, scoring points, etc.) in other areas of activity. In business, it is a way to harness the competitive spirit of sales reps, the creative drive of marketers, and the desire for recognition and the reward of everyone in between. It helps your organization boost Salesforce adoption by applying proven game mechanics to reward sales representatives to drive real business results.

      The three major pillars of gamification are Challenge, Competition, and Recognition. We can implement gamification in Salesforce using clicks not code.  There are multiple solutions possible for the above business scenario. We will use Flow and Process Builder to solve the above business requirement. Before proceeding you have to understand the below-mentioned objects in Salesforce.

      1. WorkBadge: – This object contains information about who the badge was given to and which badge was given.
      2. WorkThanks: – This object represents the source and message of a thanks post.

      We will use Flow to create WorkThanks, WorkBadge, and Chatter Post records. To launch the Flow whenever Opportunity gets Closed Won, we will use Process Builder. This article will help you to understand how to implement gamification in Salesforce by using Work.com. 

      Before discussing it, 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 5 steps to solve Martin’s business requirement using Flow and Process Builder. We must: 

      1. Steps to setup work.com
      2. Creating a custom label to store SVP of Sales & Marketing user-id
      3. Creating a custom label to store badge Id
      4. Lightning Flow Steps:
        1. Define flow properties for auto-launched flow
        2. Add a record variable to store an opportunity record data
        3. Add a text variable to store message string 
        4. Create a formula to calculate elapsed days 
        5. Use a Decision element to check elapsed days
        6. Add a create records element  – create a thanks (WorkThanks) record
        7. Add a create records element  – create a badge received (Work Badge) record
        8. Add a create records element  – post thanks badge to chatter 
      5. Process Builder Steps:
        1. Define process properties
        2. Define evaluation criteria
        3. Define process criteria
        4. Add action – flows 

      Step 1: Setup Work.com

      Follow the steps provided by Salesforce to set up work.com (some of this will need to be done in Classic).

        1. Assign a Work.com Administrator
        2. Enable Work.com Features
        3. Assign Work.com Permission Sets

      Step 2: Creating a Custom Label to Store SVP of Sales & Marketing User’s Id

      To store the ID for the SVP of Sales & Marketing, we need to get the User ID **Alternatively, you could create a variable for the ID of the specific user, but it is best practice not to hard-code User IDs**

      1. Click Setup.
      2. In the Quick Find box, type Custom Labels.
      3. Click on the New Custom Label button.
      4. Enter Short Description the Name will auto-populate. 
      5. Now enter the SVP Tushar User Id in the Value.
        1. In the Developer Console Query Editor, run the following SOQL query to get the SVP of Sales & Marketing user Id
          1. select id from user where userrole.Name=’SVP, Sales & Marketing’
      6. Click Save.

      Step 3: Creating a Custom Label to Store Badge Id

      Now we will create a Variable to store BadgeId, in this case, Badge Deal Maker.

      1. Click Setup.
      2. In the User Interface, type Custom Labels.
      3. Click on the New Custom Label button.
      4. Enter Short Description the Name will auto-populate. 
      5. Now enter the Deal Maker Badge Id in the Value.
        1. In the Developer Console Query Editor, run the following SOQL query to get the deal maker badge Id
          1. select id from WorkBadgeDefinition where Name =’Deal Maker’
      6. Click Save.

      Step 4.1: Lightning Flow – Define Flow Properties 

      1. Click Setup.
      2. In the Quick Find box, type Flows.
      3. Select Flows then click on the New Flow.
      4. Select the Autolaunched Flow (No Trigger) option and click on Next and configure the flow as follows: 
        1. How do you want to start building: Freeform
      5. Click Done.

      Step 4.2: Lightning Flow – Add Record Variable to Store Opportunity record data

      1. Under Toolbox, select Manager, then click New Resource to store Opportunity record.
      2. Input the following information: 
        1. Resource Type: Variable
        2. API Name: varROpportunity
        3. Data Type: Record
        4. Object: Opportunity
        5. Check Available for Input
        6. Check Available for Output
      3. Click Done.

      Step 4.3: Lightning Flow – Add a Text Variable to Construct Message String

      1. Under Toolbox, select Manager, then click New Resource to create a message for the email template. 
      2. Input the following information: 
        1. Resource Type: Variable
        2. API Name: varTMessage
        3. Data Type: Text
        4. Default Value: Congratulations! You Just earned Deal Maker badge for closing the Opportunity “{!VarT_OpportunityName}” within {!Day_Elapsed} days of it’s creation.
        5. Check Available for Input
        6. Check Available for Output
      3. Click Done.

      Step 4.4: Lightning Flow – Create a Formula to Calculate Elapsed time

      1. Under Toolbox, select Manager, then click New Resource to calculate elapsed time. 
      2. Input the following information: 
        1. Resource Type: Formula
        2. API Name: forNElapsedTime
        3. Data Type: Number
        4. Decimal Places: 2
        5. Formula: {!varROpportunity.LastModifiedDate} – {!varROpportunity.CreatedDate}
      3. Click Done.

                   

      Step 4.5: Lightning Flow – Using Decision Element to check Elapsed Days

      1. Drag-and-drop Decision element onto the Flow designer. 
      2. Enter Label the API Name will auto-populate.
      3. On the First Outcome enter the Label the API Name will auto-populate.
      4. When to Execute Outcome: All Conditions Are Met
        1. Row 1:
          1. Resource: {!forNElapsedTime}
          2. Operator: Less Than or Equal
          3. Value: 7
      5. Click Done.

      Step 4.6: Lightning Flow – Create Records – Create a Thanks (WorkThanks) Record

      If the time taken to successfully close a deal is less than 7, the next step is to create a WorkThanks record. 

      1. Under Toolbox, select Elements. Drag and drop Create Records onto the canvas. 
      2. Input the following information:
        1. Enter Label the API Name will auto-populate.
        2. How Many Records to Create: One
        3. How to Set the Record Fields: Use separate resources, and literal values
        4. Object: WorkThanks
        5. Set Field Values for the Thanks
        6. Row 1:
          1. Field: GiverId
          2. Value: {!$Label.SVP_Tushar_User_Id}
        7. Click Add Row
        8. Row 2:
          1. Field: Message
          2. Value: {!varTMessage}
      3. Click Done.

      Step 4.7: Lightning Flow – Create Records – Create a Badge Received (Work Badge) Record

      The next step is to create a Work Badge record.

      1. Under Toolbox, select Elements. Drag and drop Create Records onto the canvas. 
      2. Input the following information:
        1. Enter Label the API Name will auto-populate.
        2. How Many Records to Create: One
        3. How to Set the Record Fields: Use separate resources, and literal values
        4. Object: Badge Received
        5. Set Field Values for the Badge Received
        6. Row 1:
          1. Field: DefinitionId
          2. Value: {!$Label.Deal_Maker_Badge_Id}
        7. Click Add Row
        8. Row 2:
          1. Field: RecipientId
          2. Value: {!varROpportunity.OwnerId}
        9. Click Add Row
        10. Row 3:
          1. Field: SourceId
          2. Value: {!Create_WorkThanks_Record}
      3. Click Done.

      Step 4.8: Lightning Flow – Create Records – Post Thanks Badge to Chatter 

      The final item to create is the Chatter post.

      1. Under Toolbox, select Elements. Drag and drop Create Records onto the canvas. 
      2. Input the following information:
        1. Enter Label the API Name will auto-populate.
        2. How Many Records to Create: One
        3. How to Set the Record Fields: Use separate resources, and literal values
        4. Object: Feed Item
        5. Set Field Values for the Feed Item
        6. Row 1:
          1. Field: Body
          2. Value: {!varTMessage}
        7. Click Add Row
        8. Row 2:
          1. Field: CreatedById
          2. Value: {!$Label.SVP_Tushar_User_Id}
        9. Click Add Row
        10. Row 3:
          1. Field: ParentId
          2. Value: {!varROpportunity.Id}
        11. Click Add Row
        12. Row 4:
          1. Field: RelatedRecordId
          2. Value: {!Create_WorkThanks_Record}
        13. Click Add Row
        14. Row 5:
          1. Field: Type
          2. Value: RypplePost
      3. Click Done.

      In the end, Martin’s Flow will look like the following screenshot:

      Once everything looks good, perform the steps below: 

      1. Click Save.
      2. Enter Flow Label the API Name will auto-populate.
      3. Click Show Advanced.
      4. API Version for Running the Flow: 50
      5. Interview Label: Implement Gamification to Your Salesforce {!$Flow.CurrentDateTime}
      6. Click Save. 

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

      Our next task is to create a Process on the Opportunity object to launch a Flow, only when an Opportunity is closed won.

      Step 5.1: 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 5.2: Define Evaluation Criteria

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

      Record Evaluation Criteria

      Step 4.3: 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: Opportunity | StageName
          2. Operator:  Equals
          3. Type: Picklist
          4. Value: Closed Won
      5. Select All of the conditions are met (AND). 
      6. Click Advanced. 
      7. Select Yes to execute the actions only when specified changes are made to the record.
      8. Click Save.

      The reason why we would select the Yes checkbox for the question — Do you want to execute the actions only when specified changes are made to the record? — is to allow the Process Builder to execute the actions only if the record meets the criteria now, but the values that the record had immediately before it was saved didn’t meet the criteria. This means that these actions won’t be executed when irrelevant changes are made.

      Step 4.4: Add Action – Flows

      1. Below Immediate Actions, click Add Action.
      2. For Action Type, select Flows. 
      3. Name the action.
      4. Select the flow we just created – Implement Gamification to Your Salesforce.
      5. Set Flow Variables: 
        1. Row 1:
          1. Flow Variable: varROpportunity
          2. Type: Field Reference
          3. Value: Select the Opportunity record that started your process
      6. Click Save.

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

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

      Proof of Concept

      Now onwards if a business user updates the Opportunity Stage to Closed Won, then Process Builder will automatically fire and give a badge to the opportunity owner if he closes the opportunity in less than or equals to 7 days. 

      1. Opportunity Burlington Textiles Weaving Plant Generator  Third Phase is in Stage Qualification and created on 3/17/2015, 12:54 am, as shown in the following screenshot: Opportunity information before update
      2. Now update the Opportunity status to Closed-Won and check your Chatter profile ( Currently I am logged In as Brandon Schaefer).

      Final Output

      Independent Practice (You-do):

      Create an automation that posts the Key Win badge to a user’s Feed when she closes an opportunity over $25,000.  The badge should come from a Sales Executive.

      Formative Assessment:

      Identify a custom object in your org that should be shared based on the settings in a related object and create an autolaunched flow that will share the records without actual manual sharing

      Post a picture of the sharing on Twitter @automationchamp, #AutomatedSharingwithFlow

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

      Posted in Chatter, Process Builder, Sales cloud, Salesforce Flow | 17 Comments | Tagged Add Criteria Proces builder, Advanced flow, and any time it’s edited to subsequently meet criteria in Proces builder, call a flow thorugh PB, Clone a record using PB, Do you want to execute the actions only when specified changes are made to the record, Enable Process Builder, Flow and PB examples, Flow and Prcoess Builder examples, flow:interview, Formula in flow, Gamification in Salesforce, Getting started with Process Builder, How to activate Process builder, how to use Process builder, Implement Gamification to Your Salesforce, Implement gamification using PB, Implement gamification using Process Builder, InterviwLabel, Launch flow from PB, Lightning App, Lightning Process builder, PB, Prcoess builder and Chatter use case, Process Builder and Gamification, Process Builder examples, Process Builder Salesforce, Process Builder update a record action, Process builder use case, RypplePost, Spring15 process builder, Spring15 Process builder enhancement, Update Records, Visual workflow, What is Process Builder, Whenever a record is created, Work.com, Work.com and ProcessBuilder, Work.com examples with PB, Work.com examples with Process builder, WorkBadge, WorkThanks
    • Search

    • Upcoming Trainings

      Salesforce Administrator Certification
      Salesforce Advanced Administrator Certification
      Salesforce Platform App Builder Certification
      Lightning Flow & Process Builder
      Advanced Lightning Flow
      Pardot Specialist & Consultant Certification
      Sales Cloud Consultant Certification
      Service Cloud Consultant Certification
      Community Cloud Consultant Certification
    • Sponsor #1

    • Sponsor #2

    • Sponsor #3

    • Sponsor #4

    • Order Now!

    • Buy My Book

    • Buy My Book

    • Recent Posts

      • New Research: Salesforce Delivery Teams Excel in Speed but at the Expense of Quality
      • Improve Your Data Collection Strategy with Web Forms
      • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
      • Advancing Business Operations with Salesforce and QuickBooks
      • Getting Started with Salesforce Flow – Part 56 (Merge Chatter Topics with the Help of Salesforce Flow)
    • Salesforce ID Converter Build on Lightning Flow

      Converting 15 digit ID to 18 digit Salesforce ID
    • Blog Archives

    • Categories

  • Information

    • About Me
    • Affiliate Disclaimer
    • Contact Me
    • Privacy Policy
  • Top Posts

    • Learning Flow
    • Learning Process Builder
    • Getting Started with Salesforce Flow – Part 48 (Add a Topic to Multiple Records)
    • Getting Started with Salesforce Flow – Part 24 (Automatically Assign Permission Sets to New User)
    • Salesforce Spring’21 Release Quick Summary
    • Getting Started with Process Builder - Part 1 (Automatically Create a record)
    • Add mass members into Queues through Data Loader
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Salesforce Flow – Part 57 (Adding Validation to Flow Screen Components)
    • Add/Remove user into Public Group or Queue from Salesforce1 app
  • Social Media

    • View Automationchampion’s profile on Facebook
    • View Automationchamp’s profile on Twitter
    • View Rakeshistom’s profile on GitHub