Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Salesforce customizations

Posted on 2007-10-12
17
Medium Priority
?
315 Views
Last Modified: 2016-02-11
Any one has ever worked on CRM Salesforce customizations.
Any experience on S controls?

thanks
sumita
0
Comment
Question by:SUMA ANAND
  • 10
  • 7
17 Comments
 
LVL 11

Expert Comment

by:techhealth
ID: 20126523
yes and more details please?
0
 

Author Comment

by:SUMA ANAND
ID: 20126575
Hi there,

Thank you for the reply.

I am currently working on Validations on Salesforce. This is the validation that I am doing on Phone field.

1.> It should not be more than 10 digits.
2.> It should include special characters, other than hyphens.
3.> No alphabets should be allowed.

I came up with the following:-

AND(
             LEN(Phone) = 10,
             CONTAINS("0123456789", LEFT(Phone, 1)),
             CONTAINS("0123456789", MID (Phone, 2, 1)),
             CONTAINS("0123456789", MID (Phone, 3, 1)),
             CONTAINS("0123456789", MID (Phone, 5, 1)),
             CONTAINS("0123456789", MID (Phone, 6, 1)),
             CONTAINS("0123456789", MID (Phone, 7, 1)),
             CONTAINS("0123456789", MID (Phone, 9, 1)),
             CONTAINS("0123456789", MID (Phone, 10, 1))
)


It does not work.

Any ideas?
0
 
LVL 11

Expert Comment

by:techhealth
ID: 20126703
The condition in Validation setup is ERROR CONDITION, i.e., the condition you DON'T want.  Your condition formula shows the thing you DO want.  It should be the opposite, so this should work:
NOT (
AND(
             LEN(Phone) = 10,
             CONTAINS("0123456789", LEFT(Phone, 1)),
             CONTAINS("0123456789", MID (Phone, 2, 1)),
             CONTAINS("0123456789", MID (Phone, 3, 1)),
             CONTAINS("0123456789", MID (Phone, 5, 1)),
             CONTAINS("0123456789", MID (Phone, 6, 1)),
             CONTAINS("0123456789", MID (Phone, 7, 1)),
             CONTAINS("0123456789", MID (Phone, 9, 1)),
             CONTAINS("0123456789", MID (Phone, 10, 1))
)
)

by the way, if you want it to be "no more than 10 digits", it should be LEN(Phone)<=10; and your formula doesn't allow hyphen actually.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:SUMA ANAND
ID: 20126841
Hi there,

The error is displayed when I enter alphabets. However, when I enter correct number like 987-403-1102 it does not accept it. It still displays the error message.

It is a 10 digit number it should save it. That was the whole logic. Correct?

thanks
0
 

Author Comment

by:SUMA ANAND
ID: 20126870
How will I say something like this:-

If the Phone field has any value only then the error message should be displayed.


NOT (
AND(
             OR(LEN(Phone) <> 0, LEN(Phone) = 10) , \\ If the Phone field has any value
             CONTAINS("0123456789", LEFT(Phone, 1)),
             CONTAINS("0123456789", MID (Phone, 2, 1)),
             CONTAINS("0123456789", MID (Phone, 3, 1)),
             CONTAINS("0123456789", MID (Phone, 5, 1)),
             CONTAINS("0123456789", MID (Phone, 6, 1)),
             CONTAINS("0123456789", MID (Phone, 7, 1)),
             CONTAINS("0123456789", MID (Phone, 9, 1)),
             CONTAINS("0123456789", MID (Phone, 10, 1))
)
)
0
 

Author Comment

by:SUMA ANAND
ID: 20126929
I think it is conflicting with the rule built within the Salesforce for the Phone field.
When you enter a 10 digit number, it automatically does this:-

You enter - 9514268896
It converts to - (951) 426-8896

And my code above says that only digits are allowed which should not be more than 10 characters.

So when I enter something like 9514031102 - it converts to (951) 403-1102 but it conflicts with the code above that is not enter anything digits.

How do I get to atleast allow brackets and hyphens.

0
 
LVL 11

Accepted Solution

by:
techhealth earned 2000 total points
ID: 20130679
yep I forgot about the auto-formatting script of the phone field.  OK, then this should work:

AND(LEN(Phone) <> 0,
NOT (
AND(
LEN(phone)<=14,
LEFT(Phone,1)="(", MID(Phone,5,1)=")", MID(Phone,6,1)=" ", MID(Phone,10,1)="-",

CONTAINS("0123456789", MID (Phone, 2, 1)),
CONTAINS("0123456789", MID (Phone, 3, 1)),
CONTAINS("0123456789", MID (Phone, 4, 1)),
CONTAINS("0123456789", MID (Phone, 7, 1)),
CONTAINS("0123456789", MID (Phone, 8, 1)),
CONTAINS("0123456789", MID (Phone, 9, 1)),
CONTAINS("0123456789", MID (Phone, 11, 1)),
CONTAINS("0123456789", MID (Phone, 12, 1)),
CONTAINS("0123456789", MID (Phone, 13, 1)),
CONTAINS("0123456789", MID (Phone, 14, 1))
)
)
)

It only checks condition when the phone field is not empty; and it checks according to the reformatted phone value.

Note that this only works with US domestic phone numbers.  To accommodate international numbers by using the crude Salesforce functions will be a nightmare.  It's better to use regular expressions but I don't think Salesforce supports it.
0
 

Author Comment

by:SUMA ANAND
ID: 20132072
This works however, have few questions to understand this better.

Why are we using NOTs? whats the purpose here? Could I have done like this?

AND(
LEN(Phone) = 10,
NOT ( CONTAINS("0123456789", LEFT(Phone, 1))),
NOT ( CONTAINS("0123456789", MID (Phone, 2, 1))),
NOT( CONTAINS("0123456789", MID (Phone, 3, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 5, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 6, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 7, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 9, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 10, 1)))
)


thanks
sumita
0
 
LVL 11

Expert Comment

by:techhealth
ID: 20132165
Dig out your textbook on logical expressions. :-)  NOT (A AND B) is equivalent to (NOT A) OR (NOT B).  So you can certainly use:
OR(
LEN(Phone) > 14,
NOT ( CONTAINS("0123456789", LEFT(Phone, 1))),
NOT ( CONTAINS("0123456789", MID (Phone, 2, 1))),
NOT( CONTAINS("0123456789", MID (Phone, 3, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 5, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 6, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 7, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 9, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 10, 1)))
)

 instead of the part

NOT (
AND(
LEN(phone)<=14,
LEFT(Phone,1)="(", MID(Phone,5,1)=")", MID(Phone,6,1)=" ", MID(Phone,10,1)="-",

CONTAINS("0123456789", MID (Phone, 2, 1)),
CONTAINS("0123456789", MID (Phone, 3, 1)),
CONTAINS("0123456789", MID (Phone, 4, 1)),
CONTAINS("0123456789", MID (Phone, 7, 1)),
CONTAINS("0123456789", MID (Phone, 8, 1)),
CONTAINS("0123456789", MID (Phone, 9, 1)),
CONTAINS("0123456789", MID (Phone, 11, 1)),
CONTAINS("0123456789", MID (Phone, 12, 1)),
CONTAINS("0123456789", MID (Phone, 13, 1)),
CONTAINS("0123456789", MID (Phone, 14, 1))
)
)
0
 
LVL 11

Expert Comment

by:techhealth
ID: 20132200
Sorry I copied your expression and it's incomplete.  The correct OR expression should be:
OR(
NOT(LEN(phone)<=140,
NOT(LEFT(Phone,1)="("), NOT(MID(Phone,5,1)=")"), NOT(MID(Phone,6,1)=" "), NOT(MID(Phone,10,1)="-"),

NOT(CONTAINS("0123456789", MID (Phone, 2, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 3, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 4, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 7, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 8, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 9, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 11, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 12, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 13, 1))),
NOT(CONTAINS("0123456789", MID (Phone, 14, 1)))
)
)

Isn't this harder to understand than the NOT(AND()) expression?
0
 

Author Comment

by:SUMA ANAND
ID: 20132294
Thanks techhealth.

0
 

Author Comment

by:SUMA ANAND
ID: 20132424
I tried to do one more thing.

I want that the Phone field should also allow one more thing.

(951) 402-5589 x4567

Notice the extension.

So this what I did:-

AND(LEN(Phone) <> 0,
NOT (
AND(
LEN(Phone)<=18,
LEFT(Phone,1)="(",
MID(Phone,5,1)=")",
MID(Phone,6,1)=" ",
MID(Phone,10,1)="-",
MID(Phone, 15,1)="x",

CONTAINS("0123456789", MID (Phone, 2, 1)),
CONTAINS("0123456789", MID (Phone, 3, 1)),
CONTAINS("0123456789", MID (Phone, 4, 1)),
CONTAINS("0123456789", MID (Phone, 7, 1)),
CONTAINS("0123456789", MID (Phone, 8, 1)),
CONTAINS("0123456789", MID (Phone, 9, 1)),
CONTAINS("0123456789", MID (Phone, 11, 1)),
CONTAINS("0123456789", MID (Phone, 12, 1)),
CONTAINS("0123456789", MID (Phone, 13, 1)),
CONTAINS("0123456789", MID (Phone, 14, 1)),
CONTAINS("0123456789", MID (Phone, 15, 1)),
CONTAINS("0123456789", MID (Phone, 16, 1)),
CONTAINS("0123456789", MID (Phone, 17, 1)),
CONTAINS("0123456789", MID (Phone, 18, 1))
)
)
)


It does not accept the value in the phone extension..What did I miss?





0
 

Author Comment

by:SUMA ANAND
ID: 20132442
Here is the latest one:-

AND(LEN(Phone) <> 0,
NOT (
AND(
LEN(Phone)<=18,
LEFT(Phone,1)="(",
MID(Phone,5,1)=")",
MID(Phone,6,1)=" ",
MID(Phone,10,1)="-",
MID(Phone, 15,1)="x",

CONTAINS("0123456789", MID (Phone, 2, 1)),
CONTAINS("0123456789", MID (Phone, 3, 1)),
CONTAINS("0123456789", MID (Phone, 4, 1)),
CONTAINS("0123456789", MID (Phone, 7, 1)),
CONTAINS("0123456789", MID (Phone, 8, 1)),
CONTAINS("0123456789", MID (Phone, 9, 1)),
CONTAINS("0123456789", MID (Phone, 11, 1)),
CONTAINS("0123456789", MID (Phone, 12, 1)),
CONTAINS("0123456789", MID (Phone, 13, 1)),
CONTAINS("0123456789", MID (Phone, 14, 1)),
CONTAINS("0123456789", MID (Phone, 16, 1)),
CONTAINS("0123456789", MID (Phone, 17, 1)),
CONTAINS("0123456789", MID (Phone, 18, 1))
)
)
)
0
 
LVL 11

Expert Comment

by:techhealth
ID: 20132786
Be careful with counting characters - always important when you try to work with strings.  

If you allow 4-digit extension but not requiring it, then you need to consider both with or without extension:

AND(LEN(Phone) <> 0,
NOT (
AND(

LEFT(Phone,1)="(",
MID(Phone,5,1)=")",
MID(Phone,6,1)=" ",
MID(Phone,10,1)="-",


CONTAINS("0123456789", MID (Phone, 2, 1)),
CONTAINS("0123456789", MID (Phone, 3, 1)),
CONTAINS("0123456789", MID (Phone, 4, 1)),
CONTAINS("0123456789", MID (Phone, 7, 1)),
CONTAINS("0123456789", MID (Phone, 8, 1)),
CONTAINS("0123456789", MID (Phone, 9, 1)),
CONTAINS("0123456789", MID (Phone, 11, 1)),
CONTAINS("0123456789", MID (Phone, 12, 1)),
CONTAINS("0123456789", MID (Phone, 13, 1)),
CONTAINS("0123456789", MID (Phone, 14, 1)),

OR(AND(LEN(Phone)<=20,MID(Phone, 15,2)=" x",

CONTAINS("0123456789", MID (Phone, 17, 1)),
CONTAINS("0123456789", MID (Phone, 18, 1)),
CONTAINS("0123456789", MID (Phone, 19, 1)),
CONTAINS("0123456789", MID (Phone, 20, 1))
), LEN(Phone)<=14
)
)
)
)

Note that Salesforce auto-adjust to put a space between x and the main number.  That's why it ends up being 20 chars long.

A lot to digest here, isn't it?  Any more change, you'll need a new question. :)
0
 

Author Comment

by:SUMA ANAND
ID: 20132907
ok understood. :-)
I will be posting questions frequently related to Salesforce customizations in coming weeks. Since I am very new to this, and getting my hands dirty on Sandbox. Still trying to understand the syntax..:-)

I will look forward to learn from you, please do check out my postings. I am in Pacific TimeZone in LA area.

thanks again:-)

0
 
LVL 11

Expert Comment

by:techhealth
ID: 20133324
Not a problem.  I'm glad I helped and will be happy to help again.  Good luck!
0
 

Author Comment

by:SUMA ANAND
ID: 20384331
techhealth - are you there?

If you are reading this post, can you please check out my second post related to Salesforce CRM. I am looking for some answers and no one is there to help me.

thanks
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Messaging apps are amazing tools with the power to do a lot of good, but the truth is the process of collaborating with coworkers requires relationships established through meaningful communication - the kind of communication that only happens face-…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question