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
guyr1981guyr1981 

I want to validate a text entered is only digits and no letters, how can I do that?

Hi,

 

I have an object and I want one of its fields (product code) to be a number.

if I choose the field type as number it displays: 1,234,567 instead of 1234567

so I want it to be text: but I want to validate no letters were entered, how do I do that?

 

Would really appreciate the answer.

 

Thanks,

Guy 

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

You can probably do it be just using an ISNUMBER on your VR 

 

* The LEN function is optional, that's just on there to make sure they enter the full length of the Product Code and don't just enter 1 or 2 numbers.

 

 

OR(LEN(Product_Code__c ) <> 7, 
NOT(ISNUMBER(Product_Code__c )))

 

 

 

 

All Answers

Steve :-/Steve :-/

You can probably do it be just using an ISNUMBER on your VR 

 

* The LEN function is optional, that's just on there to make sure they enter the full length of the Product Code and don't just enter 1 or 2 numbers.

 

 

OR(LEN(Product_Code__c ) <> 7, 
NOT(ISNUMBER(Product_Code__c )))

 

 

 

 

This was selected as the best answer
guyr1981guyr1981

Thanks, and it did work just the ISNUMBER.

 

Thanks for that,

Guy