• Michael Sabel 9
  • NEWBIE
  • 40 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 9
    Replies
Hi, this Validation Rule works for me. It ensures the format is the following: (xxx) xxx-xxxx.

AND(
NOT(ISBLANK(HomePhone)),
NOT(REGEX(HomePhone, "\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}"))
)

Question: How can I amend the rule to allow for phone extensions? If I wanted to keep the existing phone format requirement but allow for "Ext. xxxxx" only, what would I need to do in my Validation Rule? Thanks much

Mike
The rule should fire if at least one phone field is populated and it requires the user to select a Preferred Phone. It works on Contacts, but won't fire when a phone field is populated on Leads. I'd like to figure out why and find out what the correct formula is. Thanks.

AND(
OR(
ISNEW(),
ISCHANGED(tcf_Phone_Home__c),
ISCHANGED(MobilePhone),
ISCHANGED(tcf_Phone_Work__c)
),
NOT(ISBLANK(tcf_Phone_Home__c)),
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(tcf_Phone_Work__c)),
NOT(ISCHANGED(npe01__Preferred_Phone__c)),
OR(
ISCHANGED(npe01__Preferred_Phone__c),
ISBLANK(TEXT(npe01__Preferred_Phone__c))
)
)
Here's the formula I am using for a Validation Rule to require a specific phone number format be entered (xxx) xxx-xxxx. This formula works for me.

AND(
NOT(ISBLANK(HomePhone)),
NOT(REGEX(HomePhone, "\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}"))
)

Is there anything I can add to the formula to prevent it from firing on a specific record type? Let's call it "Record Type A".

Thanks.
Hi,

I am using the below formulas in Process Builder.

Salesforce automatically updates "Preferred Phone" picklist depending on which phone number field has a number in it.  So, if the MobilePhone is populated it updates the Preferred phone with Mobile.  If the HomePhone is populated it updates the Preferred phone with Home.  If the WorkPhone is populated it update the Preferred Phone with Work. 

1. Detect Change in Phone Field: Criteria Formula
OR(AND(ISNEW(),OR(NOT(ISBLANK([Contact].HomePhone)), NOT(ISBLANK([Contact].MobilePhone)), NOT(ISBLANK([Contact].npe01__WorkPhone__c)))), 
        ISCHANGED([Contact].HomePhone),
        ISCHANGED([Contact].MobilePhone),
        ISCHANGED([Contact].npe01__WorkPhone__c))

2.  Set Preferred Phone Field: Immediate Action
CASE(
    IF(ISBLANK([Contact].MobilePhone), '0', '1') +
    IF(ISBLANK([Contact].HomePhone),       '0', '1') +
    IF(ISBLANK([Contact].npe01__WorkPhone__c), '0', '1'),
    '100', 'Mobile',
    '010', 'Home',
    '001', 'Work',
NULL
)

This works great. The problem I now need to resolved is that if two or more phones are populated the user is required to select which is the Preferred Phone.

Thanks.
So, I want to make sure that user can't type "St." for Street and must type "St" instead. And, that user can't type "Suite, 4" and must type "Suite 4".
So, no commas "," or periods ".". 

Here's what I've tried. Not working because I think what I've done here is allow for commas and periods when I'm trying to exclude them. Not sure how to exclude them.
AND(
NOT(ISBLANK(MailingStreet)),
NOT(REGEX( MailingStreet, "[a-zA-Z0-9\\.\\,]+"))
)

Thanks.
Hi, I'm using this validation rule to ensure users type in phone numbers in this format (xxx) xxx-xxxx:
NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))
 
I found this specific vr in Salesforce Help.
This is for Contacts.
Problem I'm having: The validation rule is firing even when the number is inputted in the right format. I tried it in production, developer account and sandbox and it is still doing the same thing.
Thanks.
Here's the formula I am using for a Validation Rule to require a specific phone number format be entered (xxx) xxx-xxxx. This formula works for me.

AND(
NOT(ISBLANK(HomePhone)),
NOT(REGEX(HomePhone, "\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}"))
)

Is there anything I can add to the formula to prevent it from firing on a specific record type? Let's call it "Record Type A".

Thanks.
So, I want to make sure that user can't type "St." for Street and must type "St" instead. And, that user can't type "Suite, 4" and must type "Suite 4".
So, no commas "," or periods ".". 

Here's what I've tried. Not working because I think what I've done here is allow for commas and periods when I'm trying to exclude them. Not sure how to exclude them.
AND(
NOT(ISBLANK(MailingStreet)),
NOT(REGEX( MailingStreet, "[a-zA-Z0-9\\.\\,]+"))
)

Thanks.
Hi, I'm using this validation rule to ensure users type in phone numbers in this format (xxx) xxx-xxxx:
NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))
 
I found this specific vr in Salesforce Help.
This is for Contacts.
Problem I'm having: The validation rule is firing even when the number is inputted in the right format. I tried it in production, developer account and sandbox and it is still doing the same thing.
Thanks.