+ Start a Discussion
Eric PohlabelEric Pohlabel 

Process Builder appears to trigger even though it fails the criteria

I have a process builder flow that sets the value fo a custom email field on the Case object to the value of the email field of a particular Contact related to the Account related to the case.  This process should only fire under specific conditions:
1) The Case record type name is "Content"
2)The Case.Account_Primary_Main_Contact__c field is blank (has not been previously populated)
3) The record type name of the Opportunity related to the Case is NOT "Reseller"
4) The Account.Primary_Contact__c.Email field of the Account related to the case is not blank
5) The value of the Account.Needs_Approval_For_PUblishing__c picklist field on the Account related to the case is either "Yes" or "No"

Here is the Formula I am using in the Criteria node of the process:
AND(
[Case].RecordType.Name = "Content",
ISBLANK([Case].Account_Primary_Main_Contact_Email__c),
[Case].Opportunity__c.RecordType.Name <> "Reseller",
NOT(ISBLANK([Case].Account.Primary_Contact__c.Email)),
ISPICKVAL([Case].Account.Needs_Approval_for_Publishing__c, "Yes") || ISPICKVAL([Case].Account.Needs_Approval_for_Publishing__c, "No"))
So I would expect that if the Account.Primary_Contact__c.Email field is blank...this formual woudl equate to FALSE and therefore the process would stop...instead the process attempts to run and I get the following error:
"The flow failed to access the value for myVariable_current.Account.Primary_Contact__c.Email because it hasn't been set or assigned."

If that value isn't set...shouldn't the flow follow the criteria logic and just not run on that record?







;
Abhishek BansalAbhishek Bansal
Hi Eric,

Basically with any Process Builder touching lookup fields you have to do a NULL check in your criteria. Process Builder will fail if it finds any record that doesn't have any lookup populated. You should modify the formula as below:
AND(
[Case].RecordType.Name = "Content",
ISBLANK([Case].Account_Primary_Main_Contact_Email__c),
NOT(ISNULL([Case].Opportunity__c)),
NOT(ISNULL([Case].Account)),
NOT(ISNULL([Case].Account.Primary_Contact__c)),
[Case].Opportunity__c.RecordType.Name <> "Reseller",
NOT(ISBLANK([Case].Account.Primary_Contact__c.Email)),
ISPICKVAL([Case].Account.Needs_Approval_for_Publishing__c, "Yes") || ISPICKVAL([Case].Account.Needs_Approval_for_Publishing__c, "No"))
So basically we need to check that all the lookup fields being referenced in the formula must have a value and are Not Null. Please let me know if you still face any issues with this.

Thanks,
Abhishek Bansal. 
Eric PohlabelEric Pohlabel
Thank you Abhishek, I will give this a try!