I have inherited this formula and can't really understand it and is supposedly not working. Could someone please shed some light as there are a couple of functions in here that I have never used before :S
AND(
DATEVALUE(CreatedDate) > DATE(2015,03,26),
$Profile.Id <>"00eA0000000V4vB" /*Sysadmin*/,
$Profile.Id <> '00eF0000000eBPJ' /*API*/,
Owner.Id = '005F0000001zyuN' /*Merchant OwnerUK*/,
NOT(ISBLANK(VAT_Number__c)),
AND(
NOT(REGEX(VAT_Number__c , "(AT)U[0-9]{8}")),
NOT(REGEX(VAT_Number__c , "(BE)0[0-9]{9}")),
NOT(REGEX(VAT_Number__c , "(BG)[0-9]{9,10}")),
NOT(REGEX(VAT_Number__c , "(CY)[0-9]{8}L")),
NOT(REGEX(VAT_Number__c , "(CZ)[0-9]{8,10}")),
NOT(REGEX(VAT_Number__c , "(DE)[0-9]{9}")),
NOT(REGEX(VAT_Number__c , "(DK)[0-9]{8}")),
NOT(REGEX(VAT_Number__c , "(EE)[0-9]{9}")),
NOT(REGEX(VAT_Number__c , "(EL|GR)[0-9]{9}")),
NOT(REGEX(VAT_Number__c , "(ES)[0-9A-Z][0-9]{7}[0-9A-Z]")),
NOT(REGEX(VAT_Number__c , "(FI)[0-9]{8}")),
NOT(REGEX(VAT_Number__c , "(FR)[0-9A-Z]{2}[0-9]{9}")),
NOT(REGEX(VAT_Number__c , "(GB)([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})")),
NOT(REGEX(VAT_Number__c , "(HU)[0-9]{8}")),
NOT(REGEX(VAT_Number__c , "(IE)[0-9]S[0-9]{5}L")),
NOT(REGEX(VAT_Number__c , "(IT)[0-9]{11}")),
NOT(REGEX(VAT_Number__c , "(LT)([0-9]{9}|[0-9]{12})")),
NOT(REGEX(VAT_Number__c , "(LU)[0-9]{8}")),
NOT(REGEX(VAT_Number__c , "(LV)[0-9]{11}")),
NOT(REGEX(VAT_Number__c , "(MT)[0-9]{8}")),
NOT(REGEX(VAT_Number__c , "(NL)[0-9]{9}B[0-9]{2}")),
NOT(REGEX(VAT_Number__c , "(PL)[0-9]{10}")),
NOT(REGEX(VAT_Number__c , "(PT)[0-9]{9}")),
NOT(REGEX(VAT_Number__c , "(RO)[0-9]{2,10}")),
NOT(REGEX(VAT_Number__c , "(SE)[0-9]{12}")),
NOT(REGEX(VAT_Number__c , "(SI)[0-9]{8}")),
NOT(REGEX(VAT_Number__c , "(SK)[0-9]{10}"))
)
)
3 risposte
Throw an error if:
- Created after March 26, 2013
- Profile is not Sys Admin / API
- Owner is one person (***Having both this and profiles seems redundant***)
- VAT Number isn't blank and the format isn't correct - checking against many possible Regular Expressions
REGEX is enforcing a specific format of letters and numbers. Some good examples here:
http://forceguru.blogspot.ca/2011/06/using-regex-in-validations.htmlIf I had to really knock it down
If the record is created after March 26, 2013 and the owner is set as "Merchant OwnerUK", and they enter a VAT number, make sure they enter it correctly