function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC n12SFDC n12 

Validation rule help needed

Hi,

I need help to write a validation rule for the following requirement


1) I am having a custom lookup field called as DOSApprover_c in my custom object called as "AccountExceptions__c"

2) There is another custom lookup field with account called as "Account__c" in the same custom object


when i select the account and if the account record type is "Group account" only then the field DOSApprover__c should be set mandatory 


Help me how to achieve this req validation rule


Thanks in Advance
Best Answer chosen by SFDC n12
Ravi NarayananRavi Narayanan
AND(Account__c.RecordTypeId='idofRecordType', ISNULL(DOSApprover_c ))

Mark as best answer if it solves your question

All Answers

Ravi NarayananRavi Narayanan
AND(Account__c.RecordTypeId='idofRecordType', ISNULL(DOSApprover_c ))

Mark as best answer if it solves your question
This was selected as the best answer
SFDC n12SFDC n12
but its like hardcoding the recordtype id right , will this work if its moved to Production as i am hardcoding the record type id?
SFDC n12SFDC n12
i tried the above validation rule , but didnt work
Ravi NarayananRavi Narayanan
wt error ?
SFDC n12SFDC n12
its not throwing any error , but the validation rule is not firing ,  its saving the record for a group account record type


AND(Account__r.RecordType.Name ='Group Account', ISNULL(DOSUser__c),true,false)
 
SFDC n12SFDC n12
I got it

AND(Account__r.RecordType.Name ='Group Account', NOT(ISNULL(DOSUser__c)))


I have to add NOT before DOSUser__c

it worked

Thanks dude