We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to make single line text variable on catalog item to accept Numberic/Integer value only?

Arpit Shende1
Tera Contributor

Hi There,

 

1. Create a variable with type 'Single Line Text' as per your needs

ArpitShende1_0-1679324856825.png

 

2. Go to Type Specification Tab and change the validaton Regex to 'Number' or as per your requirement.

 ArpitShende1_1-1679324898017.png

 

3. you can also limit the number of digits, End User can enter by using variable attributes 'max_length=X'

ArpitShende1_2-1679324909001.png

 

 

OUTPUT:

 

 

 

1. I can only type 3 digits because I set variable attributes 'max_length=3'

ArpitShende1_3-1679325126192.png

 

2. I cannot enter any other text, if End User does, they will recieve this error saying 'Not a Number'

ArpitShende1_4-1679325135639.png

 

Note: Not sure if I can post this here or I answered precisely, if anybody wants to help me on this, I am open for feedbacks.

0 REPLIES 0