function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
test batchtest batch 

Error element myDecision (FlowDecision). The flow failed to access the value for myVariable_current.Account__r.OwnerId because it hasn't been set or assigned.

User-added image 

What would be the issue ..? How to resolve this ..?

Best Answer chosen by test batch
NagendraNagendra (Salesforce Developers) 
Hi,

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.

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 like "The flow failed to access the value for myVariable_current.Account.Name because it hasn't been set or assigned. "

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 that 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")

Hope this helps.

Best Regards,
Nagendra.

All Answers

NagendraNagendra (Salesforce Developers) 
Hi,

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.

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 like "The flow failed to access the value for myVariable_current.Account.Name because it hasn't been set or assigned. "

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 that 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")

Hope this helps.

Best Regards,
Nagendra.
This was selected as the best answer
Ankit Kalsara 14Ankit Kalsara 14
Hi Nagendra,

I am still getting the same error despite of using the formula. I am checking my ID and email both should not be blank, then assign the email or else use the hardcoded email id.

IF(
  AND(
      NOT(ISBLANK([Commissioning_Estimate_Request__c].Opportunity__c.Lead_Commissioner__c.Id)), 
      NOT(ISBLANK([Commissioning_Estimate_Request__c].Opportunity__c.Lead_Commissioner__c.Email))
  )
  ,
  [Commissioning_Estimate_Request__c].Opportunity__c.Lead_Commissioner__c.Email
  ,
  "test@gmail.com"
)

Error Occurred: The flow failed to access the value for myVariable_current.Opportunity__r.Lead_Commissioner__r.Id because it hasn't been set or assigned.

Can you please help.