Process Builder Error - variable hasnt been set or assigned - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Swapna MistrySwapna Mistry 

Process Builder Error - variable hasnt been set or assigned

1. We have a User lookup field on the Account called Customer Success Manager.
2. I am copying that value onto the Case record via formula field: Account CSM = Account.Customer_Success_Manager__r.FirstName + ' ' + Account.Customer_Success_Manager__r.LastName

3. I have a PB that updates the Case Owner to the user that is the Account CSM. This is working perfectly if the Account has a CSM. However, not all Account have a CSM.

I am testing by sending in an email from a user on an Account without a CSM and I keep getting this error:
The flow failed to access the value for myVariable_current.Account.Customer_Success_Manager__r.Id because it hasn't been set or assigned.

I have the PB set to only fire when the Account CSM is NOT NULL.

Clearly, I am missing something here. Any help is appreciated. Screenshots are below.

User-added image

User-added image

User-added image




 

Best Answer chosen by Swapna Mistry
Mayank SrivastavaMayank Srivastava
You are right but the Process Builder can be really funky at times hence it's OK to have a safety net in place in case things don't work as expected.

Can you try replacing that Global Constant NULL statement (only the first node) with the following instead?
[Case].AccountId                           is null     Boolean    False  AND

[Case].Account.Customer_Success_Manager    is null     Boolean    False

 

All Answers

Deepak AnandDeepak Anand
Shot in the dark - Instead of comparing the Lookup Field with the $GlobalConstants.EmptyString can you try this - 
[Account].Account_CSM__c         IsNull         Boolean         False
Swapna MistrySwapna Mistry
Hi Deepak,
   Just tried that and same error.

The flow failed to access the value for myVariable_current.Account.Customer_Success_Manager__c because it hasn't been set or assigned.
Mayank SrivastavaMayank Srivastava
Swapna, how about we trying adding a catch all node at the bottom (in addition to what you have) with criteria as:
[Case].Account.Customer_Success_Manager    is null     Boolean    True

And then doing a rogue immediate action like:
  • Either updating a dummy hidden field on the object OR
  • Sending an email alert to a legit or non-legit email address 
The only intention of doing the above is to catch the exception and not let it go unhandled.
 
Swapna MistrySwapna Mistry
Hi Mayank,
  I added the addtional node and set it to update a checkbox, but I'm still getting the same error.

I dont understand why the record is even entering the process if the field is not set (blank)
User-added image

User-added image
 
Mayank SrivastavaMayank Srivastava
You are right but the Process Builder can be really funky at times hence it's OK to have a safety net in place in case things don't work as expected.

Can you try replacing that Global Constant NULL statement (only the first node) with the following instead?
[Case].AccountId                           is null     Boolean    False  AND

[Case].Account.Customer_Success_Manager    is null     Boolean    False

 
This was selected as the best answer
Swapna MistrySwapna Mistry
OMG! So happy!! That worked!!

I had tried the above critera, but instead of using IS NULL, I was using the Global Constant NULL and it wasnt working.

Anyway, a thousand thank yous!
Eyal KamaEyal Kama
I am struggling with no success. I followed the thread and the best answer but still getting the same error of flow cannot access variable cuz it was not been set or assigned.
here is a screen shot of the flow formula.
Any idea what's wrong?
User-added image
Eyal KamaEyal Kama
what worked for me at the end was to use the following formula.
NOT(isBlank([Case].AccountId ))
Fergal McMenaminFergal McMenamin
I just had the same issue, here's my simple fix: 


[Event.ActivityDate]     Greater Than     [Event].Account.My_Custom_Date__c   - gave the error 

[Event].Account.My_Custom_Date__c   Less Than   [Event.ActivityDate]      - worked

Basically I think that you can only traverse relationships on the LEFT-HAND-SIDE of the argument.

 
Ksenia ChoateKsenia Choate
I had a similar issue. These were the criteria in a PB flow:

[Case].Owner:User.ProfileId   = "XXXXXXXXXXXXXXXXXX" &&
[Case].RecordTypeId = "XXXXXXXXXXXXXXXXXX" &&
NOT(ISNEW())

I got an error saying "The flow failed to access the value for myVariable_current.Owner:User.ProfileId because it hasn't been set or assigned." The case owner was a queue, so I am guessing the system was having trouble finding owner's profile ID, since the owner wasn't a user.

Then I added a line at the top:

NOT(ISBLANK([Case].Owner:User.ProfileId) &&
[Case].Owner:User.ProfileId   = "00e70000000wy1XAAQ" &&
[Case].RecordTypeId = "012700000009seVAAQ" &&
NOT(ISNEW())

Got the same error, changed the top line to 

NOT(ISBLANK([Case].Owner:User.OwnerId)

Got the same error again. Finally, changed the top line to 

ISBLANK( [Case].Owner:Queue.OwnerId )

This worked. I wish I knew why.
 
Seva TsurikovSeva Tsurikov

Have the same issue: The flow throws an error when a criteria is specified only to execure if value exists

NOT(ISBLANK([Order].Contact.Account.Id))
&& NOT(ISNULL([Order].Contact.Account.Id))

Sagar VasaniSagar Vasani

Hi All ,
Below is the Knowledge article on this , It solves the issue for me.

https://help.salesforce.com/articleView?id=000212174&language=en_US&type=1

Regards
Sagar

Dane SheppardDane Sheppard
Hello,

What do you do if you're trying to reference a cross object field that MAY BE blank? I'm trying to create a PB that autofills a Yes/No box on the account level. It gets that information from a multi-select picklist on the Contact level. In our Org, there's a good chance that we have to create Accounts that don't necessarily have the Contact Type identified yet, but when I activate the PB, it errors out because it says Contact Type is not yet set or assigned. 
Jerome PijpersJerome Pijpers
@dane check this link https://help.salesforce.com/articleView?id=000338785&type=1&mode=1