+ Start a Discussion
Raj R.Raj R. 

How to make custom field required for only US users on campaigns using validation rule?

Hi,
 

How can I make a custom field only required for U.S. user creating campaigns using a validation rule? The custom field is textarea (string - max 255 characters) field. I need to make it required for U.S. users creating campaigns and NOT required for NON-US users creating campaign.

The following pieces of code both below fail

 

AND(
    ISPICKVAL(Type, "Webinar"),
    ISBLANK(CustomField__c),
    ISPICKVAL($User.Country__c, "United States")
)

AND(
    ISPICKVAL(Type, "Webinar"),
    ISNULL(CustomField__c),
    ISPICKVAL($User.Country__c, "United States")
)
Best Answer chosen by Raj R.
Denis VakulishinDenis Vakulishin
Hi,
Try this
AND(
    ISPICKVAL(Type, "Webinar"),
    ISBLANK(CustomField__c),
    ISPICKVAL($User.CountryCode, "US")
)


All Answers

Denis VakulishinDenis Vakulishin
Hi,
Try this
AND(
    ISPICKVAL(Type, "Webinar"),
    ISBLANK(CustomField__c),
    ISPICKVAL($User.CountryCode, "US")
)


This was selected as the best answer
Surabhi AgrawalSurabhi Agrawal
Hi,
You can create validation rule saying if  user. country is USA then custom field cannot be blank.

And(ISPICKVAL($User.Country__c, "United States"), or(ISBLANK(CustomField__c),ISNULL(CustomField__c))

Here the or() part will evaluate to true so it will throw error.