0

I created a simple validation rule on the std Account sObject

AND(
    NOT(ISBLANK(ParentId))
    , billingCountry = Parent.billingCountry
)

This validation rule causes sql errors on CRUD operations on all account records

FIELD_CUSTOM_VALIDATION_EXCEPTION:Validation Formula "Parent_Same_Country" Invalid (ERROR: Raising ValidationException.No_Data_Available at yAccessUtils.sql(8c2f6c5):log_and_raise_exception_nc:255   [SDB::APP001]
  Detail: <<null>>
  Where: PL/sdb function happy.yaccessutils.log_and_raise_exception_nc(character varying,character varying,character varying,character varying,character varying,character varying,character varying,numeric,boolean) line 75 (SFSQL 255) during statement block exit
PL/sdb function happy.caccess.check_entity_access_ncu(happy.userinfo,happy.btsettingsinfo,character varying,numeric,character varying,character varying,boolean,boolean,boolean,boolean) line 1053 (SFSQL 3439) at PERFORM
PL/sdb function happy.caccess.check_entity_access_proc_ncu(happy.userinfo,happy.btsettingsinfo,character varying,numeric,character varying,character varying,boolean,boolean,boolean,boolean) line 8 (SFSQL 3039) at assignment

SQLException while executing plsql statement: {call cAccess.check_entity_access_proc_ncu(?,?,?,?,?,?,gUtil.gtypes_bool_to_boolean(?),gUtil.gtypes_bool_to_boolean(?),gUtil.gtypes_bool_to_boolean(?),gUtil.gtypes_bool_to_boolean(?))}(EXCLUDED, EXCLUDED, 0010o00002zJ2DR, EXCLUDED, true, false, true, false, true, true)

SQLState: S0001
Detail: <<null>>
Where: PL/sdb function happy.yaccessutils.log_and_raise_exception_nc(character varying,character varying,character varying,character varying,character varying,character varying,character varying,numeric,boolean) line 75 (SFSQL 255) during statement block exit
PL/sdb function happy.caccess.check_entity_access_ncu(happy.userinfo,happy.btsettingsinfo,character varying,numeric,character varying,character varying,boolean,boolean,boolean,boolean) line 1053 (SFSQL 3439) at PERFORM
PL/sdb function happy.caccess.check_entity_access_proc_ncu(happy.userinfo,happy.btsettingsinfo,character varying,numeric,character varying,character varying,boolean,boolean,boolean,boolean) line 8 (SFSQL 3039) at assignment
File: plsdb_exec.c, Routine: operatorRaise, Line: 12176
; [conn=STANDARD:1:1:3880419:1])
Error fields: ParentId

What am I doing wrong?

1
  • 1
    This is along the lines of a GACK - open a support case with Salesforce.
    – identigral
    Commented 2 days ago

1 Answer 1

1

SOQL doesn't support the comparison of 2 fields in the where clause - see the fieldExpression section of the WHERE documentation. (And yes the error handling of this invalid case is poor.)

You will need to add a formula field that does the comparison and when check that against true in the where clause.

(I'm assuming the logic here is SOQL.)

You must log in to answer this question.

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