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: Process Builder Service Cloud

    • 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 87 (Untangling the Perplexing Filter Logic of ‘Updating Records Action’!)

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

      Check out my previous articles: 

      • Getting Started with Process Builder – Part 84 (Ever Needed to Select Multiple Picklist Values in Process Builder? How About via a Single Condition?!)
      • Getting Started with Process Builder – Part 85 (Leveraging Versatility of Rule Criteria – a Deeper Dive!)
      • Getting Started with Process Builder – Part 86 (What? Create a Process with No Action? Really?)

      In the aforementioned articles, I have discussed few advanced concepts that will help you to optimize your process. If you didn’t get a chance to read it yet, do it now! It will significantly improve your knowledge of Process Builder. Once you master the art of leveraging process builder, you will be able to easily create an optimized process!

      In this article, we will unravel a known limitation of process builder by understanding the logic behind using filter conditions in Update Records action.

      As far as Update Records action goes, currently, as of (Spring’18 release), only the following two scenarios are possible in process builder:

      1. When you use a field once, while filtering Update Records Action, then, the process builder will automatically use an ‘AND’ condition between the fields. For example, as shown in the following screenshot, both the fields (Rating and Source) are used once –  and therefore, an AND condition is automatically used between them.

      However, there may be times when a user may encounter a scenario where, s/he may need to use a field twice, as shown in the following screenshot:

      In the above scenario, the Source field is used twice. In such a scenario, the process builder automatically creates an OR condition between first and the second use of the Source Field. 

      Remember, everything happens automatically so, you do not need to define anything. 

      Now what happens if I use three different fields, where each field is used only once, to define my filter as shown below?:

      In this case, the process builder will use an ‘AND’ condition between all the three fields because they are all used only once while filtering the Update Record Action, as shown in the preceding screenshot.

      Got it?

      But, now, what if I want to define my own criteria? – as shown in the following screenshot: 

      Nope! Can not do it!

      As mentioned above, one of the limitations of the process builder is that, you cannot write own filter logic in Update Records action – as shown in the preceding screenshot.

      However, we are Salesforce Ninjas and that means, we do not accept ‘can not do it’ without a good try/fight!

      So, wait for a second, and think! Is it possible to solve the above business use case using process builder? – if your answer is still no, or even maybe, – then, read-on! It is possible that when you reach at the end of the article you may hear yourself saying – Yes, it is possible! 

      Always remember, impossible can transform into I’m possible if you don’t give up! That is exactly what I am going to show you how to do via this blog!  

      Let us work through this via a business use case

      Business Use Case

      Edward Backhouse is working as System administrator at GurukulOnCloud. He has received the following requirement:

      Whenever an Opportunity is created/updated with a Stage value prospecting then, update the Account Description field to Yes I Can!, only if, the Account fields meet the following conditions:

      Account Rating = Cold  AND Status = Active

             OR

      Account Source = Partner

      Read the rest of this entry!

      Posted in Process Builder | 6 Comments | Tagged ADM 201, adm 201 certification, Automate process in Salesforce, dev 401, Filter logic for Update Records, Filter logic for Update Records Action, filter logic on Updating Records, filter logic on Updating Records Action, filter logic on Updating Records Process Builde, Lightning Process builder, Logic on Updating Records Action, logic to filter record in process builder, Platform App Builder, Platform App Builder Exam, Process Automation in Salesforce, Process Builder, Process Builder examples, Process Builder Sales Cloud, Process Builder Service Cloud, Process builder use case, 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
    ← 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