Process builder bombs if you try and access a value on a parent relationship record on a record without a value for the parent relationship. For criteria this is easy to avoid by first checking that the lookup is not equal to null (see Check if lookup field is not null in Process Builder)
But, this doesn't seem to work in formulas. I've got the following
ISPICKVAL([CampaignMember].Status, 'Responded') &&
NOT(ISBLANK([CampaignMember].LeadId)) &&
NOT(ISPICKVAL([CampaignMember].Lead.Status , 'New')) &&
OR(
CONTAINS(LOWER([CampaignMember].Campaign.Name),'Name1'),
CONTAINS(LOWER([CampaignMember].Campaign.Name),'Name2'),
CONTAINS(LOWER([CampaignMember].Campaign.Name),'Name3')
)
If I update a campaign member that's related to a contact (and hence [CampaignMember].Lead
is null) I get the following error
The flow failed to access the value for myVariable_current.Lead.Status because it hasn't been set or assigned.
However, I thought this wouldn't happen since NOT(ISBLANK([CampaignMember].LeadId))
is evaluated before NOT(ISPICKVAL([CampaignMember].Lead.Status , 'New'))
.
I've tried using ISNULL
as well with the same the same result. Now, I'm stuck, what's the proper way to access [CampaignMember].Lead.Status
to avoid issues with null lead lookups?
AND
rather than&&
(since you already useOR
over||
). Doubt it would solve your issue but I find it easier to read (and somewhat advantageous to be more obviously distinct from code syntax). – Adrian Larson♦ Apr 18 '18 at 18:31