2

I am getting these two process builder error's

Error element myDecision (FlowDecision).

The flow failed to access the value for myVariable_current.Account.Owner.UserRole.DeveloperName because it hasn't been set or assigned.

The flow failed to access the value for myVariable_current.Account.Supplier_Status__c because it hasn't been set or assigned.

In my formula i am checking for null values, and I also have a condition to check that AccountId for the contact is not null, and that Contact.Account.Owner is Active.

Can someone please shed light as to how i can resolve the errors?

AND(
    AND(
        ([Contact].Account.Owner.UserRole.DeveloperName = 'Marketing Rep'),
        NOT(ISNULL([Contact].Account.Owner.UserRole.DeveloperName ))
    ),
    ([Contact].Account.Owner.IsActive) = true,
    ([Contact].Account.OwnerId) != '005XXXXXXXXXXXXXX',
    ([Contact].Account.Owner.Profile.Name )  = 'Marketing',
    NOT(ISNULL([Contact].AccountId)),
    ([Contact].Account.RecordType.DeveloperName) = 'Supplier_Account',
    NOT(ISBLANK([Contact].Email)),
    ([Contact].Account.ShippingCountry = 'USA'),
    AND(
        ISPICKVAL([Contact].Account.Supplier_Status__c, "Active"),
        NOT(ISPICKVAL([Contact].Account.Supplier_Status__c, ""))
    )
)
  • 3
    Might just be an order of operations thing. Try making your null check for Account.Owner.UserRole.DeveloperName before you test for a value, and see if that resolves your issue. If It does, then I can write up the reason why this one fails and why my suggestion works as an answer. – Derek F Jan 27 at 18:25
0

I have always needed to do ISBLANK() checks in any formulas that are used in process builder. Otherwise, there is a risk that a null reference error will kill the process. Notably, this includes the contents of any formula fields referenced in the process builder, not only the formulas directly defined in PB.

Your cited error message isn't specifically a null reference error, but it may be related. That portion of Process Builder has been recently updated in Spring '19, so the issue may now appear differently.

In processes and flows, a formula can reference a record’s field via a record variable or lookup relationship field. At run-time, when the record variable or lookup relationship field is null, the formula sometimes returns null. Otherwise, it returns an unhandled exception. With this update, the formula always returns a null value when the record variable or lookup relationship field is null. This update doesn’t affect merge fields. (https://releasenotes.docs.salesforce.com/en-us/spring19/release-notes/rn_forcecom_flow_cruc_formula.htm)

In your case, there are a lot of relationships included in that first line ([Contact].Account.Owner.UserRole.DeveloperName); if anything before DeveloperName is null, an error might surface.

Assuming that this is the issue, Derek F is right in pointing out that the order of operations is important; you can put your ISBLANK checks first, and have the formula return false before the null relationships are traversed.

AND(
    NOT(ISBLANK([Contact].AccountId)),
    NOT(ISBLANK([Contact].Account.OwnerId)),
    [Contact].Account.OwnerId != '005XXXXXXXXXXXXXX',
    NOT(ISBLANK([Contact].Account.Owner.UserRoleId)),
    NOT(ISBLANK([Contact].Account.Owner.ProfileId)),
    NOT(ISBLANK([Contact].Account.RecordTypeId)),
    AND(
        ([Contact].Account.Owner.UserRole.DeveloperName = 'Marketing Rep'),
        NOT(ISBLANK([Contact].Account.Owner.UserRole.DeveloperName ))
    ),
    ([Contact].Account.Owner.IsActive) = true,
    ([Contact].Account.Owner.Profile.Name ) = 'Marketing',
    NOT(ISNULL([Contact].AccountId)),
    ([Contact].Account.RecordType.DeveloperName) = 'Supplier_Account',
    NOT(ISBLANK([Contact].Email)),
    ([Contact].Account.ShippingCountry = 'USA'),
    AND(
        ISPICKVAL([Contact].Account.Supplier_Status__c, "Active"),
        NOT(ISPICKVAL([Contact].Account.Supplier_Status__c, ""))
    )
)

There may be some other things you need to do in there, such as verifying that the owner is a user, prior to traversing to it as a user (it may also be a queue etc). But the basic idea is that you need to verify that a relationship can be used (typically by being non-null) prior to actually using the relationship.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.