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
AbAb 

Validation rule code to control modification of picklist

Hello,

I have below settings:

objectCustom__c
   picklist_custom__c
   A
   B
   C

    picklist_custom1__c
    X
    Y

I want to implement Validation rule like below:

Validation Rule 1:

If picklist_custom__c  = C,
   then only User is able to choose picklist_custom1__c = X 

Validation Rule 2:
If  picklist_custom1__c = X,
 Then dont allow user to modify it

What should be validation rule code.

Thank you for sugestion.
Best Answer chosen by Ab
harsha vardhan vasa 9harsha vardhan vasa 9
For validation rule 1 u can go for dependent picklist. controlling field will control the dependent field.
 else u can write one validation rule in such a way that user has to give picklist_custom1__c  =x when picklist_custom__c  ==c:
 IF(TEXT(picklist_custom__c  ) == 'C',TEXT(picklist_custom1__c )='X',false)
 if any other value in the picklist_custom1__c  record wont be saved. 

Hope this is helpful.