Loading

Process Builder Error 'The flow failed to access the value because it hasn't been set or assigned'

Udgivelsesdato: Oct 13, 2022
Beskrivelse

A Process that makes a cross-object reference will fail when the foreign key (i.e. relationship field) the reference depends on is not populated.

For example, if a Process on Contact has the criteria '[Contact].Account.Name equals Acme', this Process will fail when triggered on a Contact where Account is blank. The generated error in Debug Logs would be 'The flow failed to access the value for myVariable_current.Account.Name because it hasn't been set or assigned.'

Løsning
To avoid this type of error, use criteria to check if the foreign key (aka relationship) field is null before making cross-object references based on that field.

The order of the criteria matters. The check to verify that a lookup is not null should be made before evaluating any conditions which make a cross-object reference across that lookup.

Continuing the example given above, the process criteria should be '[Contact].AccountId Is Null False' AND '[Contact].Account.Name equals Acme' in that order. The check for AccountId being null has to be before the cross-object reference which relies on the Account field being populated.


When using "Formula evaluates to true" in the Criteria for Executing Actions, the formula below can be used in this example:

AND (NOT(ISBLANK( [Contact].AccountId )), [Contact].Account.Name = "Acme")

Many standard relationships include "Id" in the field name, which sometimes causes confusion with regard to the field(s) which need to be checked for null values. Continuing the example above, a common mistake would be trying to check for null in "[Contact].Account.Id", which is a cross-object reference to the Id field on the Account and will fail when the Account lookup is blank. The correct criteria would check "[Contact].AccountId" (which is the Account lookup on the Contact). It is important to ensure the criteria checks the lookup field itself, rather than making a cross-object reference to the "Id" field on another object.


As mentioned in Known Issue W-2763830, this formula syntax does not work when using Formula-Based Criteria and making a cross-object reference to a Picklist field (specifically when using the TEXT or ISPICKVAL functions with the spanning reference to that picklist). If you need to make cross-object reference to a picklist field in Process Builder Criteria, use Condition-Based criteria. If you must use formula-based criteria, use the CASE function when making cross-object references to picklists.
 

Note: The error will also occur if a formula field referencing a null lookup is used as a criteria in your process builder.

 



Please also see: 
Troubleshoot Processes and this critical update 
Process builder cannot handle null of cross object on formula criteria
Troubleshooting Validation Rules In Process Builder Using Debug Logs
Vidensartikelnummer

000382782

 
Indlæser
Salesforce Help | Article