+ 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) 
SteveMo__cSteveMo__c

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

SteveMo__cSteveMo__c

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