Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Restricting decimal value

Sengeni
Tera Contributor

Hi,

For Allocation percentage, i have to restrict the decimal value .Integer type is not there.suggest me a code or script for restricting decimal value.

find_real_file.png

1 ACCEPTED SOLUTION

ok, if you open the variable you will see below option.

find_real_file.png

 

In validation regex if you dont see this "Percentage (integer from 0 to 100)" then create new with following script

find_real_file.png

(^100$)|(^([1-9]([0-9])?|0)$)

Validation message is the message you want to show.

And the question type should be single line text.

 

Thanks

Harshad

View solution in original post

3 REPLIES 3

Harshad Wagh
Tera Guru

this field is on which form? a catalog item or table?

We can use regex on field dictionary.

Thanks

Harshad

 

Hi Harshad Wagh,

I am using a catalog item.

Thanks

sengeni.D

ok, if you open the variable you will see below option.

find_real_file.png

 

In validation regex if you dont see this "Percentage (integer from 0 to 100)" then create new with following script

find_real_file.png

(^100$)|(^([1-9]([0-9])?|0)$)

Validation message is the message you want to show.

And the question type should be single line text.

 

Thanks

Harshad