We were always under the assumption formula fields used short circuit evaluation for boolean logic. But we're running into an issue we've never seen before that seems off.
Assume an object has a lookup field to another object, Lookup__c that is NULL.
Should we be able to use this guard condition in an AND function:
AND( NOT(ISBLANK(Lookup__c)), Lookup__r.Num_value_field__c > 70)
Salesforce seems to still evaluate the 2nd argument to the AND even though the 1st argument evaluates to FALSE, causing an error.
For example, if I set the following checkbox formula field on the same object, I would assume it would always evaluate to TRUE:
OR (AND (NOT(ISBLANK(Lookup__c)), Lookup_r.Num_value_field__c > 70), TRUE)
But the checkbox always evaluates to false. We're assuming that it's due to the 2nd argument to the AND being evaluated with a null reference.
Also as a double-check, we also checked the following formula, which did short circuit and doesn't result in an error:
AND(FALSE, NOT(ISBLANK(Lookup__c)), Lookup__r.Num_value_field__c > 70)
One other thing we tried is using an IF as a guard, which does work:
IF (ISBLANK(Lookup__c), FALSE, Lookup_r.Num_value_field__c > 70)
Also, it doesn't matter whether we use ISBLANK or ISNULL
Thank you for any input.