The Everyday Function: Got Milk?

This recurring series, ‘The Everyday Function’ brings Salesforce down from the cloud and into everyday life.

You are working on a new Process Builder and when testing your creation, red text flies & the flow interview error email arrives in your inbox with the message ‘ The flow failed to access the value for Some Value because it hasn’t been set or assigned.’

Huh? You take a second glance at your process criteria & action and everything looks perfect?!?! This is the most common process builder error and it is easily fixable, but without understanding the ‘why,’ it may be difficult to spot when you receive this error message.

Understanding the Issue

Your mom tells you to go the massive superstore down the road and get a gallon of milk. You walk down the road, find the giant box store, stroll in to realize you have no idea how to find the dairy section. You give up, head home, and tell your mom, ‘Sorry, couldn’t get milk, I had no idea where the diary section was…’

Even if your mom knows they have milk; without knowing where the dairy section is, you could not complete the task.

In Salesforce terms, your mom is the process builder (haha) and you are Salesforce. Either the process builder criteria or a field update in the immediate action (milk) referenced a field through a lookup relationship (dairy section) on the object for the process builder (the superstore).

For Salesforce to be able to ‘get the mlik’ you have to provide it with the section or aisle that item is located first and make sure the store actually has milk. From a technical perspective, Process Builder is really an easier method of creating flows and when building flows you have to assign values via lookups & variables for the flow to reference in later steps; this is the same with Process Builder.

The Fix

Any time you want to update a related record or reference a field on a related record, you have to first make sure the ID of that record is loaded into your process builder’s flow interview (A flow interview is a running instance of a flow; process builder is a friendlier UI for building flows).

The trick for this is quite easy; simply add a ‘null check’ in the criteria of the process builder definition.

Example: You have a ‘Primary Contact’ lookup field on the Account object and you want to use Process Builder to populate a ‘Primary Contact Email’ field from the related Primary Contact record when the Primary Contact is first assigned.

Your criteria should look like this:

Account.Primary_Contact__c is null Boolean false
Account.Primary_Contact__r.Email is null Boolean false

Account = Store
Primary Contact = Dairy Section
Email = making sure they have milk

When you edit an Account record, the Process Builder is triggered, your criteria will ensure the Primary Contact ID is loaded into the Flow Interview and that the email field is not blank.

For your immediate action, you can then update your Account.Primary_Contact_Email__c by referencing Account.Primary_Contact__r.Email without any errors.

A more complex example is with creating Asset records from Quote Products.

When a quote is accepted, you update a ‘Create Asset’ checkbox field on all quote products with Process Builder. You have another Process Builder on the Quote Products that triggers with that field update; the immediate action is to create an asset record for the related account.

You want to define Asset fields with the Product Description, Original Opportunity, and Account.

Your criteria would need to include the following:
Quote is null Boolean false
Quote.Opportunity is null Boolean false
Quote.Opportunity.AccountID is null Boolean false
Quote.Product is null Boolean false
Create Asset equals True

Now that you have loaded all of these object ids into your flow interview, on the immediate action, when you create an asset record, you can pull in values from the related Quote, Opportunity, Account, and Product without the ‘Some Value not set or assigned’ error.

Leave a Reply

Your email address will not be published. Required fields are marked *