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
DevSFDevSF 

Validation Rule to enter only 1-10 numbers

Hi 

my task is to writea valodation rule on number field that should allow only 1-10 number like rating and it should not exceed 10 
how to aciheve this...?
can anyone help out
ajay rawat 14ajay rawat 14
Hi 

   Use below formula
   testNumber__c > 10
Amit Chaudhary 8Amit Chaudhary 8
Please try below Validation rule.
 
OR (
testNumber__c < 1,
testNumber__c > 10
)



Let us know if this will help you

Thanks
Amit Chaudhary
Ken ReyesKen Reyes
Sometimes a seemingly complex validation rule ends up being really simple.  I was totally overthinking it. Thanks for this!
Suraj Tripathi 47Suraj Tripathi 47

Hi  DevSF,

Please find the solution:

OR( LEN(custom_text_field__c) <> 10, NOT(REGEX(custom_text_field__c,"^[0-9]+$")))

 

Please mark it as Best Answer if it helps!

Thanks