+ Start a Discussion
Mahesh sfdc 5Mahesh sfdc 5 

how to restrict picklist value using validation rule

Hi,

If Account type(picklist) is "ABC" and while creating contact ,On contact the field type(picklist) should be "Operations" if we select any other except "operations" it should through an error.

Error Message : ABC account should have a contact type operations.

Please suggest.

 
Ahmed Ansari 13Ahmed Ansari 13

Hi Mahesh
Please try it in contact validation Rule

Error Condition Formula :

AND(ISNEW(),  ISPICKVAL(Account.Type, "ABC"), ISPICKVAL(ContactTypeAPIName, "Operations"))

Error Message : ABC account should have a contact type operations.
 

Deepali KulshresthaDeepali Kulshrestha
Hi Mahesh,
Greetings to you!

"Error Message: ABC account should have a contact type operations."
- This error occurs because you are performing the wrong operation on account 
- You have to use a lookup to perform an operation or you have to make contact type (picklist).
- I am sharing an example please try like this:- 

Example : - 

        AND(
        ISCHANGED(Account Type),
        ISPICKVAL(Account Type),"Customer",
        NOT( there are a number of ways to do this but need more info*)
        )


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha.