+ Start a Discussion
TheLearnerTheLearner 

Writing validation rule on user, picklist and checkbox

Hi Experts,

Could anyone help me for writing validation rule for this.
If Notice Type(Notice_Type__c) = Notice, then User cannot check the field Non Working Day(Non_Working_Day__c).
If Notice Type(Notice_Type__c) = Permit or Private then User can populate (check or uncheck) the field Non Working Day(Notice_Type__c)
Vinoth Vijaya BaskerVinoth Vijaya Basker
Hi, 

Please find the below validation rule, 

AND(TEXT(Notice_Type__c) = 'Notice',  Non_Working_Day_c__c )

Hope, it helps. 


Thanks,
Vinoth
TheLearnerTheLearner
HI Vinoth,

There two conditions are there, and even we should not allow to user to check , here notic type is picklist. and not working day is check box.


If Notice Type(Notice_Type__c) = Notice, then User cannot check the field Non Working Day(Non_Working_Day__c).
If Notice Type(Notice_Type__c) = Permit or Private then User can populate (check or uncheck) the field Non Working Day(Non_Working_Day__c)
Vinoth Vijaya BaskerVinoth Vijaya Basker
This validation rule will throw an error in the following cases, 

AND(TEXT(Notice_Type__c) = 'Notice',  Non_Working_Day_c__c )

If Notice Type is Notice and Non_Working_Day is checked. 

If Notice Type is not equal to Notice, user will be allowed to check the checkbox. 

I would like to know that if there is any other picklist values available for Notice Type except these three. 


Thanks,
Vinoth


 
Abhishek BansalAbhishek Bansal
Hi ,

Since Notice Type is a piclist field so the function TEXT will no work for it.
Please use the below formula in your validation rule :

AND( ISPICKVAL(Notice_Type__c, 'Notice'), Non_Working_Day__c)
We have to use ISPICKVAL function in oredr to compare the values of picklist fields.
Since you can check or uncheck Non Working Days when Notice Type = Pemit or Private so you do not have to add anything in formula of validation rule for this.

Please let me know if you need more help or clarification on this.

Regards,
Abhishek.
Jayson Faderanga 14Jayson Faderanga 14
I'm assuming that the notice type is a picklist field.


 ISPICKVAL(Notice_Type__c, 'Notice') && Non_Working_Day__c