function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
glowitzglowitz 

HELP! - Forcing Uppercase on Field Entry Using Validations & Formulas

I have professional edition (so can't use Apex triggers) and was looking for a simple way to force all caps (uppercase) on a form field entry using validation rules. For example, if we want all our account names to be uppercase, how can this be formatted automatically?

Ideally this would work without any error messages -- it would just reformat it upon "saving" it. Also, will this work when using the "web to lead" or "web to case" form?
 
We want this to be handled directly in SFDC, not in our client or server-side application.

Thanks in advance for tips / recommended code or formula. I posted a similar request in the Ajax forum without realizing this was a more appropriate forum for my request. Thanks in advance for your help.

MarkSilberMarkSilber

There is a new formula function, UPPER, that can do this for you. In a workflow field update, just set the result to UPPER(fieldname). You can search the online help for more information.

UPPER(text) and replace text with the field or expression you wish to convert to uppercase

Hope that helps.

Mark



Message Edited by Mark Silber on 05-15-2008 05:58 AM
glowitzglowitz
Mark, thanks for your reply. I am aware of the UPPER (text) formula -- but according to SFDC documentation, workflows are not permitted in Professional Edition, which I was using (in my original post). I was hoping to find an easy fix that would work in Professional Edition. If anyone knows of one, I would appreciate your input or creative ideas. I can't afford to upgrade to enterprise edition for this one case...


 
JakesterJakester
Hi Glowitz,

Here's one approach, although it's not as comprehensive as I'd like:

Code:
or(
      left( Name,1)<>upper(left( Name,1))
     ,left( Name,2)<>upper(left( Name,2))
)

 
You're going to repeat the code above changing the 2s to 3s and then to 4s and so on. There is some limit to formulas, so I'd recommend just going as high as you can. If you only get to, for example, 20, then a user could conceivably create an account like ABCDEFGHIJKLMNOPQRSTu

If you could also change the last line to something like this:

Code:
     ,right( Name,1)<>upper(left( Name,1))

 



in order to add a check that the last character is uppercase
glowitzglowitz
Ok, you're on to something. As you say, it's quite tedious and not foolproof. It also doesn't automatically change it to all upper case -- but it is a way to provide some measure of field validation. To keep it simple, you could just check the beginning letter and the ending letter to see if they are upper case, under the assumption that "most" people wouldn't enter something like Account namE. More likely, they would enter: account name or Account Name. Unless I add workflows, I may be stuck with this...but you've given me some ideas. Thanks.
glowitzglowitz

Actually, after thinking about this more, here's a very simple formula that works everytime! This won't automatically change it, but it will validate it regardless of field length.

This seems to work:

name <> UPPER (name)

That's it. The validator compares the name as typed to the same name in all UPPER CASE. If these don't match, then it returns an error condition, and if you enter a text warning, it will warn the operator to enter the value in all caps. Now, if I could only make the data change iteself automatically, I'd be in hog heaven.

 

JP RogersJP Rogers
Thanks for the Tip this helped me as well.
BenPBenP

I created a workflow to check if the field was not all uppercase - field <> upper

 

Then created an immediate action to update that same field to all uppercase - (field name) upper (field name)

 

Works nicely

JakesterJakester
Mark (2nd post in the thread) already suggested this option, but the user doesn't have workflows.