0

I am trying create a rule that will fire if the field is not blank and the length of the field is 7 or 10 or if the field does not start with 609. Here is what I have. The problem I had was the rule was not firing as expected as a result of my logic.

AND( NOT(ISBLANK(Phone__c)), OR( LEFT(Phone__c, 3) <> "609",
LEN(Phone__c) <>7, LEN(Phone__c) <>10 ) )

2
  • And...what is going wrong?
    – Adrian Larson
    Oct 6, 2015 at 22:38
  • The length will always be either not 7 or not 10, this should fail every record.
    – Adrian Larson
    Oct 6, 2015 at 22:38

1 Answer 1

2

The issue is the logic for the 7 or 10. AS it is currently written if it - 7 then does not = 10 so result is true

try this

AND( 
  NOT(
    ISBLANK(Phone__c)
  ), 
  OR( 
    LEFT(Phone__c, 3) <> "609",
    AND(
     LEN(Phone__c) <>7, 
     LEN(Phone__c) <>10 
    ) 
  )
)

Now if it =7 or = 10 then result is false, anything else result is true

You must log in to answer this question.

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