Avoid Null Pointers in Salesforce Flows

NEW from the Tether Tips Blog – Always have a decision after a Lookup/Get element to check if records have been returned to avoid flow errors.

Having a decision after a Lookup/Get element to check if records have been returned can help avoid flow errors.

As a team we like to share tips and tricks amongst ourselves, and this small “gotcha” is something we’ve come across a few times in the past.

The Error:

When a null value is called into a Screen Flow, Salesforce will display the following message:

The Flow couldn’t find the {!GetAllOpps} Records

The Solution:

When using a ‘Get’ or ‘Lookup’ in a Flow, we recommended that you look for the checkbox that says “Assign null values to the variable(s) if no records are found”. There will be many scenarios where the lookup doesn’t find a record, so you want ensure this does not cause any errors.

Directly after the Lookup, add a decision check for Null in the variable you assign in the ‘Get’ step. See below for an example of the Get and the Decision/null check. If your background is in programming, you can think of this as your “null pointer” check.

This way, we are able to display a more meaningful error message if there are no records found or guide the user down another route to fix the underlying issue.

Flows offer a huge range of flexibility when trying to automate updates across multiple related records, and with the new releases from Salesforce they become more and more powerful, and user friendly.

Interested in learning more about how to use flows? Have a look at the video below: 

We hope this helps!

#salesforce #salesforcecrm #tethertips #crm

Share the Post: