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
RishuRishu 

Validation based on Picklist Value

Hi,
I have a Picklist Field and it has 4 Picklist Value let's say value 1, value 2, value 3 and value 4.
My requirement is - 
If value 1 is changed to value 2 or value 3 then 
VR should throw an error
Best Answer chosen by Rishu
Maharajan CMaharajan C
Hi Rishu,

Try like below:
 
AND(
ISCHANGED(Picklist__C), 
ISPICKVAL( PRIORVALUE(Picklist__C), 'value 1'),  
OR(
	ISPICKVAL(Picklist__C, 'value 2'),
	ISPICKVAL(Picklist__C, 'value 3'),
)
)

Thanks,
Maharajan.C

All Answers

AnkaiahAnkaiah (Salesforce Developers) 
Hi Rishu, 

try with below.
 
AND(ISCHANGED(Piclist__C), ISPICKVAL( PRIORVALUE(Piclist__C), 'value 2'),  ISPICKVAL(Piclist__C, 'value 3'))
If this helps, Please mark it as best answer.

Thanks!!
 
RishuRishu
Hi Ankaiah,
Thank you for reverting
But I have a doubt . When we are checking for the changee of the Picklist Value there is the possibility that at that time Picklist Value is value 4 and we are changing from value 4 to value 2 or value 3.  In that case above solution will no work I guess.
My requirement is only if the value changes from value 1 to value 2 or value 3.
AnkaiahAnkaiah (Salesforce Developers) 
Hi Rishu,

This conditionworks for when try to change the picklist value from Value 2 to value 3 then only validation fire. Can you check and confirm.

Thanks!!
 
Maharajan CMaharajan C
Hi Rishu,

Try like below:
 
AND(
ISCHANGED(Picklist__C), 
ISPICKVAL( PRIORVALUE(Picklist__C), 'value 1'),  
OR(
	ISPICKVAL(Picklist__C, 'value 2'),
	ISPICKVAL(Picklist__C, 'value 3'),
)
)

Thanks,
Maharajan.C
This was selected as the best answer
p.saikumar kumarp.saikumar kumar

I need to make a validation rule with picklist. If Picklist value is "Yes" all 3 other custom fields to be populated (cannot be empty). The formula below works only with one of them, does not take all of them, can someone help me with it? Thanks!

AND( ISPICKVAL( Immediate_Relatives__c , "Yes"), ISBLANK(Relative_Full_Name__c)&& ISBLANK( Relationship_to_you__c)&& ISBLANK(Status__c ))
AnkaiahAnkaiah (Salesforce Developers) 
Hi Saikumar, 

try with below.
AND( ISPICKVAL( Immediate_Relatives__c , "Yes"), OR(ISBLANK(Relative_Full_Name__c),ISBLANK( Relationship_to_you__c),ISBLANK(Status__c )))

If this helps, Please mark it as best answer.

Thanks!!