Validation Rule: 2 fields required prior to saving with certain picklist value - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Tim BrevartTim Brevart 

Validation Rule: 2 fields required prior to saving with certain picklist value

Hi Salesforce community,

Trying to set up a VR here. On Accounts of the Vendor Record Type, I need to ensure that two fields, Vendor Class (picklist) and Monthly Purchase Target (text) either have a value selected or have text entered prior to the allowing the Status field to be changed to "Existing - Active."

I think I'm almost there, but I'm not sure how to build out the logic for Vendor Class in order to say "you need to select a value in this". This is what I have so far:

AND( RecordType.Name="Vendor",
                OR(
                                ISPICKVAL(Status__c,"Existing - Active"),
                                OR(
                                                ISBLANK(Vendor_Class__c),
                                                ISBLANK(Monthly_Purchase_Target__c)))


Any help would be appreciated as usual! Thank you!

Tim
Best Answer chosen by Tim Brevart
Tim BrevartTim Brevart
Got it! ISBLANK() works when you nest TEXT() within it:

AND(
RecordType.Name="Vendor",
ISPICKVAL(Status__c,"Existing - Active"),
OR(
ISBLANK(TEXT(Vendor_Class__c)),
ISBLANK(Monthly_Purchase_Target__c))
)

This worked :)

All Answers

Jayson MoralesJayson Morales
Hi Tim,

Try this:
AND( 
RecordType.Name="Vendor",
ISPICKVAL(Status__c,"Existing - Active"),

OR(
ISBLANK(Vendor_Class__c),
ISBLANK(Monthly_Purchase_Target__c))
)
Hope this helps.

Regards,
Jayson
Tim BrevartTim Brevart
Hi Jayson,

Thanks for the reply! Apparently picklist fields can't be used with the ISBLANK() logic:

Error: Field Vendor_Class__c is a picklist field. Picklist fields are only supported in certain functions. 

Best,

Tim
Tim BrevartTim Brevart
Got it! ISBLANK() works when you nest TEXT() within it:

AND(
RecordType.Name="Vendor",
ISPICKVAL(Status__c,"Existing - Active"),
OR(
ISBLANK(TEXT(Vendor_Class__c)),
ISBLANK(Monthly_Purchase_Target__c))
)

This worked :)
This was selected as the best answer