You need to sign in to do that
Don't have an account?
Margot Fabre 16
Find out if a string as "At least 5 numbers"
Hi
I need to check a checkbox field "Has Phone" if the phone number field as at least 5 digits
( The reason for 'at least 5' rather than just 'not blank' is to avoid including "1" and the reason for '5 numbers' rather than '5 characters' is to avoid including words like "no number")
We're just trying to check if the contact has a valid phone number but we want to leave the sales people the ability to write anything in the field like reception, ext., etc ...
Any ideas ?
Thanks a lot
I need to check a checkbox field "Has Phone" if the phone number field as at least 5 digits
( The reason for 'at least 5' rather than just 'not blank' is to avoid including "1" and the reason for '5 numbers' rather than '5 characters' is to avoid including words like "no number")
We're just trying to check if the contact has a valid phone number but we want to leave the sales people the ability to write anything in the field like reception, ext., etc ...
Any ideas ?
Thanks a lot
Please find the updated code below:
Thanks,
Abhishek Bansal.
All Answers
You can use the below formula:
It will work when you have numeric value in Phone.
Thanks,
Abhishek Bansal.
Thanks for the quick answer :)
But not this does not work
I have "05968474893 -ext 1343" in my phone field then the ISNUMBER formula doesn't work.
Any other ideas
Thanks
I think your requirement is to check 5 numbers in the Phone field and along with that it can also have alphabets or symbols also. So for this you need to write the logic in trigger as there is no formula to handle this.
Let me know if you need any help with the trigger code.
Thanks,
Abhishek Bansal.
Gmail: abhibansal2790@gmail.com
Skype: abhishek.bansal2790
Phone: +917357512102
This is what I was afraid of ...
I'd love some help in writting the trigger, I have never done it before :)
Thanks again !
Please find the trigger code below:
Please take care of the comments and replace the field API name. Let me know if there is an issue.
Thanks,
Abhishek Bansal.
Thank you so much for this !
I have forgotten to mention that it should be based on 3 different phone fields DDI__c, MobilePhone and Phone
Would you mind adding the "OR logic" into the trigger ?
Thank you
Can you please provide some more details? Do we need to check each field separately or combine the value from all the three and then check if the cobined string has 5 numbers. Please clarify.
Thanks,
Abhishek Bansal.
If any of these fields has at least 5 number , then the "Has phone" field has to be checked
Ex 1 :
MobilePhone = 05968474893 -ext 1343
Phone = "no phone"
DDI__c = blank
--> Has phone = check
Ex 2 :
MobilePhone = 123
Phone = "no phone"
DDI__c = blank
--> Has phone = Uncheck
Hope this makes sense
Thanks
Please find the updated code below:
Thanks,
Abhishek Bansal.
Thank you !
I have deployed the trigger and it works well on edit of a contact
I have used data loader to mass update all contacts (using a custom checkbox that I checked to mass update) but for some reason it has not been picked up
Aren't trigger running on mass update with data loader ? Any idea on how I can mass update my 22K contacts ?
Thanks a lot
Margot
Sorry not technical enough to get that - I understand the logic but I don't know how to do it
Can you help me with this please too ?
So it's normal the records have not been updated with PB ? Aren't the triggers launched on edit of the contact ? So If I edited them all with my PB it shouldn't have worked ? Is this specific to trigger ?
Just trying to understand what is happening here :) !
Thanks
Margot