2

Yet again this has simple validation has me baffled

Aim – If mailing country = Canada, then Canada_Email_Consent__c needs to be captured, if mailing country not equal to Canada then Canada_Email_Consent__c is not applicable

Field Label : Canada Email Consent

Data type : Picklist

Values : Yes/No

Okay First of all I have created the following validation;

Validation rule : Mailing Country

Error Formula:

ISBLANK(MailingCountry)

Second validation i have is

Rule name : Testing_Canada_Email_Consent

Error Formula:

AND( 
Upper(MailingCountry) = 'CANADA', 
ISBLANK(TEXT(Canada_Email_Consent__c)) 
)

Currently with the rules set up in place, if you type any other country Canada_Email_Consent__c is populated to yes. if mailing country = canada then Canada_Email_Consent__c is required

looking forward to your help

8
  • Is MailingCountry also a picklist?
    – Jagular
    Commented Jun 23, 2014 at 15:44
  • @ Jagular - I cant describe it, but when you type a characther it narrows down your search. For eg if i type in U into the mailing country, i get the values, USA,UK, Uganda etc
    – user8746
    Commented Jun 23, 2014 at 15:47
  • @user8746 can you paste what you see in your debug log, it should say the validation name and that the rule fails and why it failed
    – Rao
    Commented Jun 23, 2014 at 16:09
  • @Rao- the rule is not failing. Currently, if the mailing country is not equal to Canada its populating Canada_Email_Consent__c with YES. I want it to say that if mailing country is not Canada, then Canada_Email_Consent__c should not be applicable. if mailing country is Canada, then they should have the choice from "Yes or No" from the field Canada Email Consent
    – user8746
    Commented Jun 23, 2014 at 16:13
  • These are validation rules. Is there also a workflow rule affecting the field?
    – Jagular
    Commented Jun 23, 2014 at 16:35

1 Answer 1

1

You need the or condition... OR(AND( Upper(MailingCountry) <> 'CANADA', NOT(ISBLANK(TEXT(Canada_Email_Consent__c))), AND( Upper(MailingCountry) = 'CANADA', ISBLANK(TEXT(Canada_Email_Consent__c)) )

3
  • hi JJbennett530 thank you for providing a answer, however when i populate mailing country with UK for eg the field "Canada Email Consent" is being populated to yes, when in fact the field shouldnt be populated at all.
    – user8746
    Commented Jun 24, 2014 at 8:10
  • A validation rule checks to see if the fields have the correct content, a workflow rule can be set up to populate the field or you could have a dependant picklist or a formula field, that sets the data. You might also check to see if there is a default value for that picklist field.
    – Jenny B
    Commented Jun 24, 2014 at 12:03
  • jjbennett530 the validation is -- OR(AND( Upper(MailingCountry) <> 'CANADA', NOT(ISBLANK(TEXT(Canada_Email_Consent__c)))), AND( Upper(MailingCountry) = 'CANADA', ISBLANK(TEXT(Canada_Email_Consent__c))) ) and i also had a workflow updating the field whoopsie. Thank you for your assistance
    – user8746
    Commented Jun 24, 2014 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .