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
NlandNland 

Validation Rule between two picklists

I am working on the "Task" fields for  "Activities" and trying to create a validation rule based on two different picklist values.


The following is my formula, but I have no idea how to keep from getting errors........


AND(ISPICKVAL( Subject ,"AOP"),(ISPICKVAL( AOP_Task_Type__c ,"")))

Error: Incorrect parameter for function ISPICKVAL(). Expected Picklist, received Text

 

I have tried many different ways to get this to work with no success....

 

Scenario: If "AOP" is chosen as the subject, an AOP_Task_Type field is required. (Both fields are picklists)

 

Any help would be greatly appreciated....

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
NlandNland

I was able to get my validation rule to work using the following:

 

AND(ISPICKVAL(AOP_Task_Type__c ,""),(Subject="AOP"))

All Answers

NlandNland

I was able to get my validation rule to work using the following:

 

AND(ISPICKVAL(AOP_Task_Type__c ,""),(Subject="AOP"))

This was selected as the best answer
mlaffertymlafferty

When I have compared two picklist values, I have had to use the ISBLANK function for one of the fields. I am new to formulas as well, but this one one worked for me when needing to prompt the user to fill in a field.

 

AND(NOT(ISPICKVAL(  Field1__c , "")), ( ISBLANK(  Field1_Options__c )), License_Key_Needed__c =True)

 

Try this AND(ISPICKVAL( Subject ,"AOP"),(ISBLANK ( AOP_Task_Type__c ,"")))