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: Spring15 process builder

    • 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
    • Getting Started with Salesforce Flow – Part 42 (Running a Flow in System Mode)

      Posted at 1:50 PM by Rakesh Gupta, on November 21, 2020

      Big Idea or Enduring Question:

      How do you run a Lightning Flow in system mode? 

      Objectives:

      This blog post will help us to understand the following

      • Difference between user mode vs system mode? 
      • How to create a flow that runs in the system mode

      Business Use case

      Vigne Kozacek is working as a System Administrator at Universal Containers (UC). They normally grant read access to account records to account team members. He received a requirement to develop an application that will allow all users to add Chatter followers to the account record without editing it. (It should also work in case if they have only read access to the account record.)

      Automation Champion Approach (I-do):

      In this article Getting Started with Process Builder – Part 20 (Add Chatter Followers to Record), we had discussed a way to auto-add Chatter followers to an account record using Process Builder. But it will only work for System Administrators or users with the Edit permission on the Account object. There are few business scenarios where a business wants to implement this for all users so that anyone can add followers without editing the account record. Let’s start working through the solution for the business use case.

      We will use Flow and Process Builder because it runs in system mode. Before proceeding ahead, you have to understand User mode and System mode in Salesforce. 

      • System mode: In which the object and field-level permissions of the current user are ignored. 
      • User mode: In which the permissions, field-level security, and sharing rules of the current user are enforced.

      A few points to remember

      • By default, Screen Flow runs in user mode.
        • But Salesforce provides an ability to runs it in system mode.
      • Record-Trigged Flow always runs in system mode.
      • Scheduled-Trigged Flow always runs in system mode.
      • Process Builder runs in system mode.
      • When you launch a Flow using the Process Builder, then it will run in system mode.

      Before discussing the solution, 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 Vigne’s business requirement using Lightning Flow. We must: 

      1. Define flow properties for screen flow
      2. Create a text variable 
      3. Create a screen to capture the user data
        1. Add a screen element
        2. Add a Lookup component 
        3. Add a create records element
      4. Setup the flow runtime mode 
      5. Create a quick action 

      Step 1: 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 Screen Flow option and click on Next and configure the flow as follows: 
        1. How do you want to start building: Freeform
      5. It will open the flow designer for you.

      Step 2: Create a Text Variable 

      Want the quick action to send the record’s ID to your flow? Create a variable like below and the rest Salesforce will handle for you. 

      1. Under Toolbox, select Manager. Click on the New Resource. 
      2. Input the following information:
        1. Resource Type: Variable
        2. API Name: recordId
        3. Data Type: Text
        4. Default Value: {!$GlobalConstant.EmptyString}
        5. Check Available for Input
        6. Check Available for Output
      3. Click Done. 

      Step 3.1: Add a Screen Element 

      1. Under Toolbox, select Elements. Drag and drop Screen onto the canvas. 
      2. Input the following information:
        1. Enter Label the API Name will auto-populate.
      3. Click Done. 

      Step 3.2: Add a Lookup Component to capture the user data whom they want to make a follower of the record

      1. Under Input section on Screen Element. Drag and drop Lookup onto the screen. 
      2. Input the following information:
        1. Enter API Name.
        2. Field API Name: CreatedById (Enter the field API Name that will show up in the list box to represent a record.)
        3. Label: Select a Follower (Enter a label that appears next to the lookup control)
        4. Object API Name: Account ( Enter the object API name) 
        5. Required: {!$GlobalConstant.True}
      3. Click Done.

      Step 3.3: Add a Create Records Element to add followers into the 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: Entity Subscription
        5. Set Field Values for the Entity Subscription
        6. Row 1:
          1. Field: ParentId
          2. Value: {!recordId}
        7. Click Add Row
        8. Row 2:
          1. Field: SubscriberId
          2. Value: {!Select_a_Follower.recordId} (RecordId from screen component lookup field added in the step 3.2)
      3. Click Done.

      Step 4: Setup the Flow Runtime Mode

      For a flow running in the user context, the running user’s profile and permission sets determine the object permissions and field-level access of the flow. When a flow attempts to create, read, edit, or delete Salesforce data, it enforces the running user’s permissions and field-level access. For example, if the running user doesn’t have the edit permission for the Account object, and the flow attempts to update account records, an error occurs. If the running user doesn’t have permission to edit the Rating field on the Account object, and the flow attempts to update that field, an error occurs.

      You can set a flow version to always run in the system context, overriding the context it normally runs in. If you choose system context with sharing, the flow respects org-wide default settings, role hierarchies, sharing rules, manual sharing, teams, and territories. But it doesn’t respect object permissions, field-level access, or other permissions of the running user.

      1. Connect the elements. It will look like the image below.
      2. Click Save.
      3. Enter Flow Label the API Name will auto-populate.
      4. Click Show Advanced.
      5. How to Run the Flow: System Context Without Sharing-Access All Data
      6. Type: Screen Flow
      7. API Version for Running the Flow: 50
      8. Interview Label: Add details to Account object {!$Flow.CurrentDateTime}
      9. Click Save. 

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

      Step 5: Create a Quick Action – Add Follower 

      The next step is to create a quick action (Add Follower) on the Account object to call the Flow and add it to the page layout. 

      1. Click Setup.
      2. In the Object Manager, type Account.
      3. Select Buttons, Links, and Action, then click New Action.
      4. Input the following information:
        1. Select Flow as Action Type.
        2. Select Add Follower to Record as Flow.
        3. Enter Label the Name will auto-populate.
      5. Click Save.

      Make sure to add the above quick action on the page layout. 

      Proof of Concept

      In this demo, I am going to use Adam Smith’s account (Profile assigned – Standard Read-Only). 

       The next step is to click on the Add Follower button and follow the instructions available on the Flow screen.

      Finally, check out the Follower section available on the record detail page.

      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!

      Posted in Chatter, Process Builder, Salesforce Flow | 5 Comments | Tagged Add Chatter Followers to Record, Add Chatter Followers to Record using PB, Add Chatter Followers to Record using Process Builder, Add Criteria Proces builder, Add follower, Add follower to record, Add subscriber, Add subscriber to record, ADM 201, adm 201 certification, adm 201 salesforce, admin release exam, Advance flow, Chatter, Cloud Flow Designer Workbook, Con 201, Create record through flow, Custom button, dev 401, DEV401, developer release exam, Enable Process Builder, EntitySubscription, Evaluate the rule when a record is created, flow, Flow and PB examples, Flow and Prcoess Builder examples, FLow and Process builder example, Flow Example, Flow examples, Flow in System mode, Flows, Flows run in user mode, follow records, Getting started with Process Builder, How to activate Process builder, how to use Process builder, Launch a Flow, Launch a Flow from Process builder, Lightning App, Lightning Process builder, New Flow, PB, Record Create, Run a Flow in System Context, Run a Flow in System Mode, run in system mode Flow, Run Salesforce Flow in System Context, Run Visual workflow in system mode, Running a Flow in System Context, Running a Flow in System Mode, salesforce, salesforce Admin exam, salesforce certified developer exam, Salesforce Certified Sales Cloud Consultant, salesforce chatter, Salesforce Flow, Salesforce maintenance exam, Salesforce release exam, Salesforce release exam dates, Salesforce release exams, Spring15 process builder, Spring15 Process builder enhancement, Update Records, Visual flow
    ← Older posts
    • 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

      • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
      • Streamline Data Collection with Salesforce-Connected Forms
      • Getting Started with Salesforce Flow – Part 56 (Merge Chatter Topics with the Help of Salesforce Flow)
      • Getting Started with Salesforce Flow – Part 57 (Adding Validation to Flow Screen Components)
      • Getting Started with Salesforce Flow – Part 55 (Add or Remove Followers to a Record 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

    • Salesforce Spring’21 Release Quick Summary
    • Learning Flow
    • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
    • Getting Started with Salesforce Flow – Part 42 (Running a Flow in System Mode)
    • Learning Process Builder
    • 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)
    • Getting Started with Salesforce Flow – Part 24 (Automatically Assign Permission Sets to New User)
    • Add Record to Multiple Chatter Groups - Parsing Multi-Select Picklist fields (Flow)
    • Getting Started with Salesforce Flow – Part 33 (Prior Value of a Record in Record-Triggered Flows)
  • Social Media

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