could you please suggest how to improve my validation rule for the following situation:
Now I have such rule "The first two characters of the Deal ID need to indicate the correct country"
AND (
NOT(ISBLANK(sf42_DealID__c)),
NOT( MID( sf42_DealID__c , 1, 2) = Account.sf42_Country_Code_ISO2__c )
)
Now Netherlands is the part of Germany in terms of Deal ID. It means that Netherlands have to put now these first 2 letters DE instead of NL.
How to specify it in this valid.rule. Smth like
Account.sf42_Country_Code_ISO2__c (NL) = Account.sf42_Country_Code_ISO2__c (DE)
I am not so familier with the right syntax how to write it correctly.
Thanks in advance.
Best Regards
Kirill
7 answers
You could grab below one:- This will combine NL & DE & will rest leave other as they were earlier:-
AND(
NOT(ISBLANK(sf42_DealID__c)),
OR(
AND(
OR(
contains(LEFT(sf42_DealID__c,2),"NL"),
contains(LEFT(sf42_DealID__c,2),"DE")),
OR(
NOT(Contains(Account.sf42_Country_Code_ISO2__c,"NL"))
NOT(Contains(Account.sf42_Country_Code_ISO2__c,"DE")))),
AND(
NOT(contains(LEFT(Bsf42_DealID__c,2),"NL")),
NOT(contains(LEFT(Bsf42_DealID__c,2),"DE")),
NOT( MID(Bsf42_DealID__c,1,2)= Account.sf42_Country_Code_ISO2__c ))))
Make sure you have right fields name in the formula , & it just takes fraction of seconds for testing,Let me know if you face any issues.