+ Start a Discussion
Karthik B.ax1475Karthik B.ax1475 

Validation rule based on dropdown list

Hi Folks,

       This is with regard to validation rule that i want to apply on Account object.

We have a custom field Countries which is a dependent list on Regions.

   Lets say :

Region:

North America

 

Coutries:

Greenland
Mexico
United States of America

 

On account object we have a standard filed called "Billing Country" here i wann to validate the Billing Country entered should match with any value of countries dropdown list.

 

Please help me on this.

 

Thanks,

Karthik

SwarnasankhaSwarnasankha

Hi Karthik!

 

You can use the following VR:

 

AND
(
    NOT(ISBLANK(BillingCountry)),
    NOT(ISBLANK(TEXT(Country__c ))),
    BillingCountry <> TEXT(Country__c )
)

 

The VR will fire only when a user provides a value for the Billing Country as well as selects a Country Name from the Country picklist but the values do not match. The matching will be Case Sensitive.

 

In case you want the matching to be Case Insensitive, use the following VR:

 

AND
(
    NOT(ISBLANK(BillingCountry)),
    NOT(ISBLANK(TEXT(Country__c ))),
    LOWER(BillingCountry) <> LOWER(TEXT(Country__c ))
)

 

Hope this helps answer your query.

Karthik B.ax1475Karthik B.ax1475

Hi Swarnasankha,
Thank you for looking at my issue. I have tested this VR but here "Billing Country" should exactely match with "Country" selected here my concer is user can enter any value from from dropdown list available.

Lets say

Region:
North America

Coutries:
Greenland
Mexico
United States of America


Here user can enter either greenland, Mexico or United States of America.


Thanks,
Karthik

SwarnasankhaSwarnasankha

Hi Karthik!

 

If you are looking for the match to be exact then try this:

 

AND
(
    NOT(ISBLANK(TEXT(Country__c ))),
    BillingCountry <> TEXT(Country__c )
)

 

This VR will ensure that if the User has entered a value for Country picklist, then they will need to provide the same value for the Billing Country and cannot leave the Billing Country as empty.