You need to sign in to do that
Don't have an account?
Rahul Kumar Dey
Validation Rule help- A custom field need to be 14 character length including space break. If Custom field not capturing space break then it should be 11 character length.
Hey guys,
I try to create a validation rule where custom field ABN__c should be 14 character length if there are any spaces but if there is no space then it should be 11 characters length.
my validation as of now -
AND(NOT(ISBLANK(ABN__c)),
OR(LEN(ABN__c) != 14,
AND( NOT(REGEX( ABN__c,'[a-zA-Z-0-9- ]')) ,LEN(ABN__c) != 11) )
)
Thanks in advance
Rahul:)
I try to create a validation rule where custom field ABN__c should be 14 character length if there are any spaces but if there is no space then it should be 11 characters length.
my validation as of now -
AND(NOT(ISBLANK(ABN__c)),
OR(LEN(ABN__c) != 14,
AND( NOT(REGEX( ABN__c,'[a-zA-Z-0-9- ]')) ,LEN(ABN__c) != 11) )
)
Thanks in advance
Rahul:)
Instead of REGEX you can use CONTAINS to check whether the field contains space or not.
AND(
NOT(ISBLANK(ABN__c)),
OR(
AND(CONTAINS(ABN__c , ' '),LEN(ABN__c) != 14),
AND(NOT(CONTAINS(ABN__c , ' ')) ,LEN(ABN__c) != 11
) ) )
Thank you!
All Answers
Instead of REGEX you can use CONTAINS to check whether the field contains space or not.
AND(
NOT(ISBLANK(ABN__c)),
OR(
AND(CONTAINS(ABN__c , ' '),LEN(ABN__c) != 14),
AND(NOT(CONTAINS(ABN__c , ' ')) ,LEN(ABN__c) != 11
) ) )
Thank you!
Thank You,
Rahul:)