There is a look up relation between 2 objects. Parent object has picklist field "State".The requirement is to create validation rule on child object to throw error if lookup field is changed and the previous parent the lookup was pointing to has state field as "NY".The validation rule i came up with is this
AND( ISPICKVAL(Parent_Object__r.State__c , "NY"),ISCHANGED( Lookup_Field__c ) )
but the error gets thrown if the lookup value is changed and new lookup value has state field as "NY".The requirement is to check if previous Parent the lookup was pointing to before changing lookup field and check if its State field was "NY". I am aware of PRIOR value function but not sure how to use it to get prior value of lookup. How can that be achieved
Lookup_Field__c
andParent_Object__c
and you forgot to replace it? if not, if theParent_Object__c
is changed at the same time as theLookup_Field__c
, which state you would like to check forNY
, a) the one the record had before saving or b) the one that it has now?