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: Activate a Process

    • Getting Started with Salesforce Flow – Part 44 (Auto Convert Marketing Qualified Leads)

      Posted at 9:13 PM by Rakesh Gupta, on December 1, 2020

      Big Idea or Enduring Question:

      How do you set automation to auto-convert marketing qualified leads? 

      When there is a chance of further negotiations with a lead, it can be converted into an account, contact, optionally an opportunity. In short, once the lead status has reached a certain stage, it can be qualified as a potential. On conversion, all the lead details are transferred in creating an account, contact, and optionally an opportunity. The lead conversion process is a manual process, if you want to automate it then you have to use Apex code. This article will help you to understand how to automate the lead conversion process using the Lightning Flow. 

      Objectives:

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

      • Use After-save Record-Triggered Flow to auto-convert marketing qualified leads 
      • Understand @InvocableMethod Annotation
      • Use Schedule-Triggered Flow to call an Apex method

      Business Use Case

      Pamela Kline is working as a System administrator in Universal Container. She has received a requirement from the management to auto-convert marketing qualified  (i.e. leads with Rating = Hot) leads and create an account and contact record.

      Automation Champion Approach (I-do):

      While this can be solved using various automation tools like Apex or Process Builder and Apex, we will use After-save Record-Triggered Flow and call an Apex method. To call an Apex method, add the Call Action element to your flow and select an Apex class with a @InvocableMethod Annotation. It means they allow us to extend the Lightning Flow by writing Apex code that meets certain criteria and then invoking the Apex from our Flows. If the class contains one or more invocable variables, manually enter values or reference field values from a related record. @InvocableMethod Annotation supports bulk operations. Let’s begin the solution for the business use case.
       
      In this article, we will use the call LeadConvert database class from Apex code. Make sure to review it. 
       
      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 2 steps to solve Pamela’s business requirement using Lightning Flow. We must: 

      1. Create an Apex class and test class
      2. Lightning Flow Steps:
        1. Define flow properties for record-triggered flow
        2. Adding an action to Call an Apex Class

      Step 1: Create an Apex class and Test class   

      1. Click Setup.
      2. In the Quick Find box, type Apex Classes.
      3. Clicks on the New button.
      4. Copy code from GitHub and paste it into your Apex Class. 
      5. Click Save.

      Repeat the above steps and click the Test class. You can get the code from my GitHub repo. 

      Step 2.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 Flows.
      4. Select the Record-Triggered Flow option and click on Next and configure the flow as follows: 
        1. How do you want to start building: Freeform
        2. Trigger the Flow When: A record is created or Updated
        3. Run Flow: After the record is saved
        4. Object: Lead
      5. Select All Conditions Are Met (AND). 
      6. Set Conditions
        1. Row 1
          1. Field: Lead | Rating
          2. Operator: Equals 
          3. Value: Hot
      7. Choose the Option to Only when a record is updated to meet the condition requirements.
      8. Click Done.

      Step 2.2: Lightning Flow – Call an Apex Class

      The next step is to call the AutoConvertLeads class from flow so that when flow fires it auto-convert the leads.

      1. Under Toolbox, select Element. 
      2. Drag-and-drop Action element onto the Flow designer. 
      3. In the Action box, type AutoConvertLeads.
      4. Clicks on the AutoConvertLeads apex class. 
      5. Enter a name in the Label field; the API Name will auto-populate.
      6. Set Input Values: 
        1. Row 1:
          1. LeadIs: {!$Record.Id}
      7. Click Done.

      In the end, Steven’s Flow will look like the following screenshot: Once everything looks good, perform the below steps: 

      1. Click Save.
      2. Enter Flow Label the API Name will auto-populate.
      3. Click Show Advanced.
      4. Type: Record-Triggered Flow
      5. API Version for Running the Flow: 50
      6. Interview Label: Auto Convert Leads {!$Flow.CurrentDateTime}
      7. Click Save. 

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

      Proof of Concept

      Now onwards, if a business user updates the Lead Rating to Hot, Lightning Flow will automatically convert such leads and create an account as well as a contact. 

      1. Currently, the lead Gaurav Pradhan is Open and the Rating is Warm as shown in the following screenshot:
      2. Now we update the Rating to Hot and see the flow magic. 
      3. Flow auto converts the Lead and create an Account and Contact or it.

      Note: –  I will suggest you implement this first in your developer org, test it and then move it to production. The same approach will work for the case assignment rule. Download Apex and Test class from GitHub. 

      Process Builder Approach

      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 Apex, Process Builder, Sales cloud, Salesforce Flow | 99 Comments | Tagged Activate a Process, Add action Process Builder, Add Criteria Proces builder, ADM 201, adm 201 certification, adm 201 salesforce, After-save flow After save flow, Auto convert Lead, Auto convert Lead in Salesforce, Auto convert Lead using Apex, Auto convert Lead using Apex Trigger, Auto convert Lead using PB, Auto convert Lead using Process, Auto convert Lead using Process Builder, Auto Convert Leads, Auto Convert Leads Apex trigger, Auto Convert Leads Automation Champion, Auto Convert Leads in Salesforce, Auto Convert Leads in Salesforce using APex, Auto Convert Leads in Salesforce using Apex Trigger, Auto Convert Leads in Salesforce using Process Builder, Auto Convert Leads process, Auto Convert Leads Process Builder, Auto Convert Leads process in Salesforce, Auto Convert Leads process in Salesforce codeAuto Convert Leads process in Salesforce code, Auto Convert Leads process in Salesforce Proces, Auto Convert Leads process in Salesforce Process, Auto Convert Leads Rakesh Gupta, Auto Convert Leads Salesforce, Automation Champion, flow, flow builder in salesforce, flow builders, Lightning Flow, lightning flows in salesforce, Lightning Process builder, Platform App Builder, Platform App Builder Exam, Process Builder, Process Builder examples, Process Builder rakesh, Process Builder Sales Cloud, Process Builder Salesforce, Process Builder Service Cloud, Process builder use case, Process Criteria, Process management, sales force automation software, salesforce, salesforce Admin exam, salesforce automation, salesforce automation tools, salesforce certified developer exam, salesforce flows, salesforce lightning flow, salesforce lightning flow examples, Salesforce Online Training, Salesforce Platform Developer I, Salesforce Platform Developer I Exam, Salesforce Training, when a record is created or edited
    • Getting Started with Process Builder – Part 85 (Leveraging Versatility of Rule Criteria – a Deeper Dive!)

      Posted at 10:30 AM by Rakesh Gupta, on April 3, 2018

      Note:- In this article, among other things, I am going to spotlight on one of the most underutilized features of setting up Rule Criteria in Process Builder – ‘Formula Evaluates to True’; because ‘Conditions are met’ feature of the Action Group is used often, we are all well versed in it. But, how many of us have used it, or can, or know when to use ‘Formula evaluates to true’ feature of Rule Criteria?

      So, the next question is, when would one need to use ‘Formula evaluates to true’ feature to define criteria for Action Group? Any guess?

      In my last article Getting Started with Process Builder – Part 84 (Ever Needed to Select Multiple Picklist Values in Process Builder? How About via a Single Condition?!), I discussed how a user can select multiple values of one picklist while defining the criteria in a single stroke.

      Thanks to all of you for your positive feedbacks! Well done guys, you learnt something new!

      In this article, I am going to discuss another problem that I recently faced, and share my experience – Process fails with “The flow failed to access the value for [example] because it hasn’t been set or assigned – If you created processes using Process Builder before then, you must be familiar with this error. Ah! Pesky!

      Let me unravel this mystery by offering an example: As a System Administrator, you receive a requirement to auto-update a Contact’s Description field (= Key Customer) whenever Account Annual Revenue is Greater than $10M. 

      If you define your criteria, like I did in the preceding screenshot, then the system would throw the following error at you – The flow failed to access the value for myVariable_current.Account.AnnualRevenue because it hasn’t been set or assigned – as shown in the following screenshot – when Account Name field is not populated on the Contact record:  Read the rest of this entry!

      Posted in Process Builder | 2 Comments | Tagged Access Picklist value in Flow, Access Picklist value in Process Builder, Activate a Process, ADM 201, adm 201 certification, adm 201 salesforce, dev 401, Platform App Builder, Platform App Builder Exam, Process Builder examples, Process Builder Sales Cloud, Process Builder Salesforce, Process Builder Service Cloud, Process builder use case, reference Picklist field in the Flow, reference Picklist field in the process, salesforce Admin exam, salesforce certified developer exam, Salesforce Freelancer, Salesforce Independent Architect, Salesforce Independent Consultant, Salesforce Online Training, Salesforce Platform Developer I Exam, Salesforce Training, Use CASE formula in the Flow, Use CASE formula in the Process Builder, use ISPICKVAL and TEXT in flow, use ISPICKVAL and TEXT in process builder
    ← 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

    • Learning Flow
    • Learning Process Builder
    • Salesforce Spring’21 Release Quick Summary
    • Getting Started with Process Builder - Part 1 (Automatically Create a record)
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Salesforce Flow – Part 4 (Need to Redirect a User to a New Record?)
    • Getting Started with Process Builder – Part 2 (Adding a Time-dependent Action)
    • Getting Started with Process Builder – Part 3 (Automatically Clone a Record if it Meets Certain Criteria)
    • Add mass members into Queues through Data Loader
    • Getting Started with Salesforce Flow – Part 24 (Automatically Assign Permission Sets to New User)
  • Social Media

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