Skip to main content

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 what this flow is attempting to accomplish.

Let's dive deeper into the actions of this flow.

  1. Click the Manager tab in the Toolbox section.
  2. Click the Email_Acct_Owner action.
  3. Review what this action is attempting to do. It will send an email with a pre-filled body and subject. However, we want the email to be sent to the account owner of the associated account.
  4. Delete the contents of the Email Addresses (comma-separated) text box.
  5. Enter record in the Email Addresses (comma-separated) text box and select $Record. Then select Account, then Owner, and finally Email.
    Email Addresses with variable information added.
  6. Click Done.
  7. Click Save As then Save.
  8. Click Debug.
  9. Click Run.
  10. Click Expand All in the Debug Details.

And… uhhh nothing? What do you mean, “No triggering record was specified, so the flow didn't run”? This flow can't be triggered in debug because debug can't create a new contact. Without a new contact, the flow is never triggered into action. 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. From within Setup, click the App Launcher.
  4. Select Sales and click the Contacts tab.
  5. Click New.
  6. Enter the following: 
    1. First Name: Steve
    2. Last Name: Rogers
    3. Account: [leave blank]
  7. Click Save.
  8. 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. 0 recipients
  9. Copy the portion of the error message that reads “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. 

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. Also, take note of the Flow error: click here to debug in Flow Builder link to see the visualization of the path the flow followed. This is especially helpful when you have a flow with a lot of branches.

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. Note: This org has been adjusted to ensure successful account owner email delivery. If implementing this idea in a production org (test in a sandbox org first!), it may require unselecting "Activate bounce management" (Setup > Email > Deliverability > unselect Activate bounce management) and unselecting "Enable compliance with standard email security mechanisms" (Setup > Email > Deliverability > unselect Enable compliance with standard email security mechanisms) to ensure email delivery.

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, details about each flow element that the flow interview executed, and a link to the visualization of the failed flow.
  • 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: 0 recipients.
  3. Press Enter.
  4. Select the Knowledge Articles checkbox to filter for just Knowledge Articles results.
  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 the setup gear 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.The Start element on the Flow Builder canvas
  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 Save As.
  10. Ensure A New Version is selected.
  11. Leave all other options as they are.
  12. Click Save.
  13. 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.

Resources

無料で学習を続けましょう!
続けるにはアカウントにサインアップしてください。
サインアップすると次のような機能が利用できるようになります。
  • 各自のキャリア目標に合わせてパーソナライズされたおすすめが表示される
  • ハンズオン Challenge やテストでスキルを練習できる
  • 進捗状況を追跡して上司と共有できる
  • メンターやキャリアチャンスと繋がることができる