Getting Started with Process Builder – Part 85 (Leveraging Versatility of Rule Criteria – a Deeper Dive!)

Getting Started with Process Builder – Part 85 (Leveraging Versatility of Rule Criteria – a Deeper Dive!)

Last Updated on April 15, 2019 by Rakesh Gupta

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: 

To overcome this challenge you have to use ‘Formula evaluates to true’ feature of the Rule Criteria and add NOT (ISBLANK([Contact].AccountId)) formula, as shown in the following screenshot: 

Good job!

But wait! not so fast! For, you have not crossed the finish line yet!!  

Despite populating the Account Name, the problem – or the error – will persist if you try to reference a picklist field using TEXT or ISPICKVAL functions! This is because, this is one of the Salesforce’s current

Well, we are undaunted Salesforce Ninjas; so, let us march ahead and create a workaround to address the issue!

 

Having defined the problem above, now let me share my trick to solve the above business use case using a simple CASE formula. Let us start with a business use case.

Business Use Case

Edward Backhouse is working as System administrator at GurukulOnCloudAt GurukulOnCloud they are using Process Builder to streamline Sales Processes. Today, Edward received a requirement to auto-update Contact Description field to Eligible for free trainings – if account Type =Partner 

Solution for the above business requirement

There are few possible solutions for the above business scenario, but we will use Process Builder to solve the above business requirementBefore trying to understand the technical aspect of the solution, let us spend some time to understand the Case formula in Salesforce and how to use it. 

  1. To create a new process from scratch, click on the New Button available on Process Management page. A popup will appear where you have to enter the Name (Use Reference picklist field – process criteria formula as the name)API Name and Description as shown in the screenshot below:
  2. Once you are done, click on the Save button.
  3. Click on the Object node to add object and then select the Contact object. For the entry criteria, select when a record is created or edited, as shown in the screenshot below:
  4. Once you are done, click on the Save button.
  5. The next task is to add Process Criteria, so that process will only fire when it meets the stated criteria. To do this click on Add Criteria, enter NameType of action and set filter conditions, and follow the instructions below
    1. For Formula evaluates to true, select Build Formula
    2. Enter the folloiwng formula – NOT(ISBLANK([Contact].AccountId)) && CASE([Contact].Account.Type,”Partner”,1,0)=1
      At the end, process criteria will look like the following screenshot: 

  6. Once you are done, click on the Save button.
  7. Now we have to add an Immediate action to the Process to create a quotation record. Click on Add Action (Under Immediate actions), Select the type of action (In our case Update Records), and then fill the values into fields to define the action – as shown in the following screenshot:
  8. Once you are done, click on the Save button. 
  9. In the end, your Process will look like the following screenshot:
  10. Do not forget to activate the Process by clicking on the Activate button.

It’s time to test this feature

Next time, when Contact records are created, or updated, by the user, the process we created (Using Process Builder) will fire and check the criteria – if the Contact is not associated with an Account record – then it will not give the error, as shown in the following video. 

I hope you learnt couple of new ideas from the blog: (1) how to leverage one of the most underutilized feature of the Define Criteria for the Action Group – ‘Formula evaluates to true’;

and, how to reference picklist values in Process Builder criteria node!!

Yes, go ahead! Show off your newly acquired skills to your friends, colleagues and families!

Please feel free to add constructive comments, insights – and yes, challenges too! – to the blog. Good Luck in your Journey towards becoming a Salesforce Ninja!

Note: – I am thankful to Resco.net and Smartcloud.io for sponsoring my blog.

Technical Editor and Proofreader: - Munira Majmundar
Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

Preferred Timing(required)

2 thoughts on “Getting Started with Process Builder – Part 85 (Leveraging Versatility of Rule Criteria – a Deeper Dive!)

  1. What a great, helpful article. So well written an explained- thank you! I love highlighting great Salesforce blogs at the Maine User Group- yours will be well received I’m sure.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Automation Champion

Subscribe now to keep reading and get access to the full archive.

Continue reading