Fix Issues Caused by a Null Value in a Flow

Learning Objectives 

After completing this unit, you’ll be able to:

  • List resources for researching solutions.
  • Use resources outside of the org to fix the broken flow.
  • Explain the importance of accounting for a null value.

Here We Flow Again

Sometimes the issue isn’t as straightforward as a user permission problem. The problem could be anything from faulty logic to bad input data to not accounting for when a value is left blank. As stated before, even the tiniest of problems can “break” the flow. All parts, big and small, need to do their job or the flow does not work as expected.

The Problem

As the admin, you have set up a flow to email the account owner anytime a new contact is added to an account they own. However, users now need to enter contacts that aren’t associated with an account. The flow seems to be set up correctly but the users keep receiving an error when adding a contact without an associated account. Just as you did before, look over the flow and run the debug feature to see what’s going on.

Investigate the Broken Flow

Follow these steps to get to know this broken flow.

  1. Depending on your browser, close the debug window or tab and return to the Flow Builder screen.
  2. Click back Flow Builder back button in the Flow Builder.
  3. Click the Alert Acct Owner of New Contact Added flow.
  4. Review the flow to see what it’s trying to accomplish. Note: We’re using the word “trying” since this flow doesn’t currently work as intended.
  5. Click Debug.
  6. Click Run.

And… something went wrong. What do you mean, “You can’t launch a record-triggered flow from within Flow Builder”? Unfortunately you can’t use the debug feature on this type of flow. What can you do? Time to do some traditional troubleshooting. Step one, re-create the issue your users are experiencing. 

Activate the flow, add a contact without an associated account, and see what happens.

  1. Depending on your browser, close the debug window or tab and return to the Flow Builder screen.
  2. Click Activate.
  3. Close the Flow Builder tab or window.
  4. From within Setup, click the App Launcher.
  5. Select Sales and click the Contacts tab.
  6. Click New.
  7. Enter the following: 
    1. First Name: Steve
    2. Last Name: Rogers
    3. Account: [leave blank]
  8. Click Save.
  9. Review the error message.
    New Contact error message: We can’t save this record because the “Alert Acct Owner of New Contact Added” process failed. Give your Salesforce admin these details. Probably Limit Exceeded or 0 recipients
  10. Copy the portion of the error message that reads “Probably Limit Exceeded or 0 recipients” (you need that later). Leave the New Contact window open.

Now that you’ve seen the error message, go ahead and add an account to this new contact to see how the flow works under ideal circumstances.

  1. Enter GenePoint under Account Name.
  2. Select GenePoint from the picklist.
  3. Click Save.

You should now have two new emails in your inbox. The first one is an error email from when you tried to save the contact without associating an account. When a flow fails, Salesforce sends an email to the admin (unless otherwise designated) that includes the error message from the failure and details about each flow element that the flow interview executed. 

Flow error email excerpt

As you can see from the flow error email, there is an issue when the flow looks for the account owner email. This makes perfect sense. The flow can’t find the account owner email because an account has not been associated with the new contact. If there’s no account, there’s no account owner email.

The second email is the result of the successfully triggered flow. You added the new contact with an associated account. You also happen to be the account owner of the GenePoint account, so you get the email alert. 

Email sent by flow when new contact was created

The flow performed as expected and notified the account owner (you) that a new contact has been associated to an account you own. As the admin, you would probably not also be the account owner, but for training purposes this example allows you to see the flow from all perspectives.

Help Is Here

While things can seem bleak, all is not lost. Help is here. There are numerous resources beyond the debug feature to help you fix your broken flow. Roll up your sleeves and dig into some resources.

  • Flow Error Email—This important resource gives you specifics related to your flow problem and is extremely helpful as you troubleshoot. The email includes the error message from the failure and details about each flow element that the flow interview executed.
  • Salesforce Help—Search knowledge articles, best practices, known issues, and more. This resource allows you to search articles as well as community posts. After reviewing the flow error email, this should be your next stop when troubleshooting a broken flow.
  • Trailblazer Community Groups—Although they’re not necessarily an immediate resource for your troubleshooting problems, these user groups are a wealth of information and knowledge. Community Group members network, learn together, exchange ideas, and troubleshoot.
  • Salesforce Developer Documentation—The source of truth for Salesforce developers. Developer documentation is still worth researching, as there are nuggets of knowledge that an admin, like yourself, can use.

Since you’ve already reviewed the flow error email, your next stop is Salesforce Help. Use the search feature to find help articles, relevant posts, or Trailhead topics. 

  1. Navigate to help.salesforce.com.
  2. Enter the error message you copied from before into the search bar: Probably Limit Exceeded or 0 recipients.
  3. Press Enter.
  4. Click the ARTICLES tab to filter for Knowledge Articles.
  5. Click the Knowledge Article entitled: Error 'Probably Limit Exceeded or 0 recipients' after Process Builder is triggered
  6. Read over the knowledge article.

Although this article references Process Builder, it contains valuable information for your automation issue. Process Builder and Flow Builder are different tools, but they both have the same end goal: process automation. You can use some Process Builder troubleshooting tips for your flow issue. To learn more about the different tools for process automation, earn the Salesforce Flow badge on Trailhead. 

Null Value, No Problem

The article lists three ways to make your automation work when you get this error. 

  • Create a validation rule to require that the field has a value.
  • Make the field required.
  • Update your process so that the email alert should only fire when the email field has a value.

The first two options are not viable solutions for your situation since they don’t allow for when users legitimately need to enter a new contact that does not have an associated account. The best option is option three, only send an email alert when the email field has a value. This means that your flow should attempt to email the account owner only when the account can be found. 

  1. In your org, click on the gear icon Setup gear and select Setup.
  2. Enter flows in the Quick Find box and select Flows.
  3. Click Alert Acct Owner of New Contact Added.
  4. Click Edit next to Object: Contact.
    Highlighted edit button on Start Record-Triggered Flow
  5. In the Condition Requirements picklist, select All Conditions Are Met (AND).
  6. Click in the Field text box and select AccountId.
  7. Change the Operator to Is Null.
  8. Click in the Value text box and select $GlobalConstant.False.
    Condition Requirements added to the Contact object.
  9. Click Done.
  10. Click Save As.
  11. Ensure A New Version is selected.
  12. Leave all other options as they are.
  13. Click Save.
  14. Click Activate.

You added a condition to the contact object telling the flow to not proceed to the next step if the AccountID is null (blank) and thereby not attempting to email the account owner. Next, test to see if your fix works by entering a contact without an associated account.

  1. Close the Flow Builder tab or window.
  2. From Setup, click the App Launcher.
  3. Select Sales and click the Contacts tab.
  4. Click New.
  5. Enter the following: 
    1. First Name: Lily
    2. Last Name: Mason 
    3. Account: [leave blank]
  6. Click Save.

No error message! More confetti. You fixed the flawed flow. The flow does not produce an error if the account field on a new contact is blank. But if a user adds a new contact with an associated account, the account owner receives an email notification as planned. Note: If you wanted to make sure the flow only emails account owners that are active users, add a decision element (active vs inactive) before the email element. Learn more about the Flow Element - Decision at Salesforce Help. 

You fixed all the purposefully broken flows. You debugged as a different user, used Salesforce Help to find an answer, and added a filter to an object within a flow to account for a null value. If only putting together furniture were this easy.

Give Us Your Feedback

We'd love to hear what you think about Flow Troubleshooting. Take a couple of minutes to fill out this survey. When you click the link, you leave Trailhead to fill out the survey in Salesforce, which opens in a new window.

Resources