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
chris lim 15chris lim 15 

validation rule to block a field from editing except when a value selected

Hello, i have a question i would like to add a condition to this validation rule :

i have an opportunity type picklist is A, B and C related to an other custom object type picklist has 1,2 and 3. the opportunity can not take the value C if the custom object is not 3.

i write this validation rule
AND( ISPICKVAL(Opportunity.Type, "C"), NOT(ISPICKVAL(Custom_Object__c.Picklist_Field__c, "3")) )

But i would like to add a condition to this validation rule :
if a value on Account object is D, the validation rule does not apply
 
Arun Kumar 1141Arun Kumar 1141

Hi Chris,
Try the below validation rule
AND(
    ISPICKVAL(Opportunity.Type, "C"),
    NOT(ISPICKVAL(Custom_Object__c.Picklist_Field__c, "3")),
    NOT(ISPICKVAL(Account.Field__c, "D"))
)

Mark it as best answer if this helps.
Thanks

chris lim 15chris lim 15
Sorry i forgot to say it's not a picklist, Ispickval doesn't work. It's a record type (Id or name)