4

Here's a snippet from a process builder formula that was working in production (or at least not giving syntax errors when saved) until recently.

'(PRIORVALUE([Contact].npsp__Primary_Affiliation__r.Invoicing_Contact__c)==[Contact].Id'

This is part of a formula in a process that runs when a contact is saved or edited. This is attempting to reference data on a related record. I have to assume that it was working in the past (or at least not causing errors in the process.

Apex test code that worked a month ago started failing this week. That test code has not changed. The reason for the failure was the process that contained this condition. The error for the test code points to the process, but the error message in the log shows the following (summarized):

"Invoicing_Contact__c is unsupported in ISCHANGED and PRIORVALUE."

The documentation on PRIORVALUE does not mention that lookup fields can't be used in PRIORVALUE. The process can be saved and no error message is given at that time. Is this something that has changed with the Spring 21 release? The timing makes this a possibility, but I see nothing in the release notes that appear relevant.

1 Answer 1

2

Few Steps needs to confirm in your org's Process builder or flow -

  • In processes and flows, a formula can reference a record’s field via a lookup relationship field or record variable. If the lookup relationship field or record variable is null, the formula sometimes returns null. Otherwise, it returns an unhandled exception.
  • In Spring 21 release, Salesforce plans for this update - Check for Null Record Variables or Null Values of Lookup Relationship Fields in Process and Flow Formulas (Update, Postponed)
  • With this update the formula always returns a null value when the lookup relationship field or record variable is null. This update doesn’t affect merge fields.
  • This update, released in Spring ’19, was scheduled for enforcement in Spring ’21, but was postponed to Spring ’22.
  • Above formula contains lookup relationship field, so make sure to confirm a logical check on the reference field first to determine if it is null before trying to reference the values within.
  • Null check of the variable will stop the execution there itself and stop causing the above issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .