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
VijayNiVijayNi 

validation rule for multiple picklist values

Hi Team,

I am trying to create a validation Rule i have custom Field called status it has 4 picklist values(NEW,old,current,upgraded) when any one of the value is selected user shou;ld not be able to edit the Fields.


AND(
    ISPICKVAL( status__c,'NEW'),
    OR(
        ISCHANGED( NHPMS__Re_Admit__c ),
        ISCHANGED( NHPMS__Discharge_Date__c ),
        ISCHANGED( Next_Appointment__c )
)
    ISPICKVAL( status__c,'old'),
    OR(
        ISCHANGED( NHPMS__Re_Admit__c ),
        ISCHANGED( NHPMS__Discharge_Date__c ),
        ISCHANGED( Next_Appointment__c ))
    )
    ISPICKVAL( status__c,'current'),
    OR(
        ISCHANGED( NHPMS__Re_Admit__c ),
        ISCHANGED( NHPMS__Discharge_Date__c ),
        ISCHANGED( Next_Appointment__c ))
    
)
    ISPICKVAL( status__c,'upgraded'),
    OR(
        ISCHANGED( NHPMS__Re_Admit__c ),
        ISCHANGED( NHPMS__Discharge_Date__c ),
        ISCHANGED( Next_Appointment__c ))
    
)
)
Best Answer chosen by VijayNi
Surya GSurya G
Hi Vijay,
try this if this works.

AND(
        OR(
             ISCHANGED( NHPMS__Re_Admit__c ),
             ISCHANGED( NHPMS__Discharge_Date__c ),
             ISCHANGED( Next_Appointment__c )
             ),
        OR(
              ISPICKVAL( status__c,'NEW'),
              ISPICKVAL( status__c,'old'),
              ISPICKVAL( status__c,'current'),
              ISPICKVAL( status__c,'upgraded')
           )
        )
Thanks 
Surya G

All Answers

Surya GSurya G
Hi Vijay,
try this if this works.

AND(
        OR(
             ISCHANGED( NHPMS__Re_Admit__c ),
             ISCHANGED( NHPMS__Discharge_Date__c ),
             ISCHANGED( Next_Appointment__c )
             ),
        OR(
              ISPICKVAL( status__c,'NEW'),
              ISPICKVAL( status__c,'old'),
              ISPICKVAL( status__c,'current'),
              ISPICKVAL( status__c,'upgraded')
           )
        )
Thanks 
Surya G
This was selected as the best answer
CharuDuttCharuDutt
Hii Vijay Unmeda
Try Below Validation
AND(
        OR(
              ISPICKVAL( Status__c,'New'),
              ISPICKVAL( Status__c,'Old'),
              ISPICKVAL( Status__c,'Current'),
              ISPICKVAL( Status__c,'Upgraded')
           ),
       OR(
             ISCHANGED( NHPMS__Re_Admit__c ),
             ISCHANGED( NHPMS__Discharge_Date__c ),
             ISCHANGED( Next_Appointment__c )
             )
        )
Please Mark It As Best Answer If It Helps
Thank You!

 
ravi soniravi soni
hy Vijay,
Try Below Rule.
OR(
ISPICKVAL( status__c,'NEW'),
ISPICKVAL( status__c,'old'),
ISPICKVAL( status__c,'current'),
ISPICKVAL( status__c,'upgraded')
)

Try above rule and I don't think you need  ISCHANGED because simply if user select Status new or any that has mentioned and try to save then it will work and if status is already selected before creating validation rule even if will work.

apply it and let me know if it helps you and marking it as best answer.
Thank you
Michael Foster 5Michael Foster 5
There are a total of 10 values for Sales_Stages__c. I want a Validation Rule to prevent a User from selecting Quote - 0%, Quote - 25% , Quote - 50%, Reservation – 75%, Confirmed – 100%, Confirmed Execution – 100%

List of Values for Sales_Stages__c:
Quote Opportunity Low 25%
Quote Opportunity Medium 50%
Quote Opportunity High 75%
Won 100%
Quote - 0%
Quote - 25%
Quote - 50%
Reservation – 75%
Confirmed – 100%
Confirmed Execution – 100%

When I use the following, the rule allows the record to be saved if I select any value. 
OR(
ISPICKVAL( Sales_Stages__c ,'Quote - 0%'),
ISPICKVAL( Sales_Stages__c ,'Quote - 25%'),
ISPICKVAL( Sales_Stages__c ,'Quote - 50%'),
ISPICKVAL( Sales_Stages__c ,'Reservation - 75%'),
ISPICKVAL( Sales_Stages__c ,'Confirmed - 100%'),
ISPICKVAL( Sales_Stages__c ,'Confirmed Execution - 100%')
)
I tried replacing OR with AND. I tried using " instead or '. 

Appreciate the feedback