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
SapamrmSapamrm 

Force users to put data in capitals

I would like certain fields in our sfdc-environnement only to be filled with data in capital letters. So from the moment users input data that is not in capitals, they should get an error message when trying to save the record.

 

Is this possible?

 

 

 Thanks in advance!

Best Answer chosen by Admin (Salesforce Developers) 
SapamrmSapamrm

I got the answer on another discussion board! This works perfectly!

 

 

NOT(REGEX(field__c, "[A-Z]+$"))

All Answers

_Prasu__Prasu_

While saving you can make changes in the string by using string.toUpperCase() method.

 

Or you can write a JavaScript on lost focus event of input field.

SapamrmSapamrm

I presume using the string.toUppercase() method involves some coding.

 

Is it possible to achieve this by using a simple validation rule and formula?

 

I tried using the formula LOWER() ; the validation rule works fine if as long as all the letters are not in capitals. From the moment the first letter is in capitals, the validation rule does not  work anymore.

Any idea how I could fix this, so that the validation rule evaluates to true as soon as 1 letter in the name is not a capital?

SapamrmSapamrm

I got the answer on another discussion board! This works perfectly!

 

 

NOT(REGEX(field__c, "[A-Z]+$"))

This was selected as the best answer
banders5144banders5144

Where did you put that regular expression to verify the user was putting in all caps?