Decimal field says it is not a number unless its an integer

bigbacon
Giga Guru

I have a form field that is of type decimal and for some reason if you put in a decimal number it comes back and says it is not a number. If you put in an integer, no problem. 

 

I have 3 other fields that are also decimal and are used in t he same way and they do not have this issue.

 

The validation is internal to ServiceNow and not based on a UI policy so somewhere in SN it thinks this field should be something that it is not.

1 ACCEPTED SOLUTION

@bigbacon 

Open that variable configuration and seems some variable validation Regex is applied which shows that message only for that variable and not for other 2.

Definitely it's coming from there

AnkurBawiskar_0-1737478869614.png

 

AnkurBawiskar_1-1737478916822.png

 

The Regex checks the value is Number or not and shows that message

AnkurBawiskar_2-1737478949333.png

 

If you wish to remove that validation then clear that "Validation Regex" field from that variable

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

@bigbacon 

Ideally should not behave like this

any dictionary attribute added there which is doing this?

did you try creating a new decimal filed?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Robbie
Kilo Patron
Kilo Patron

Hi @bigbacon,

 

Can you share a screen shot of the error message please?

When you state "it comes back and says it's not a number" - can you expand on how and when the error is fed back to the user? Is it a field level message? (Displayed under your decimal field)? Or is it displayed as a error message at the top of the form?

When is it displayed, on change of the value and when you click off the field or on save/submit of the form?

 

Typically, an Out Of Box (OOB) decimal field handles non decimal values for you in that if you type a string (alpha characters in the field), it will not allow them alpha characters for example and simply replace with the previously saved value or set the value to 0) - Don't forget, a decimal fields will by default also accept integer values.

 

I would check for any client scripts (if triggering on change for example) or Business Rules to see if the error message has been implemented.

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.




Thanks, Robbie

bigbacon_0-1737467067719.png

This is what it is doing. the other 3 fields around it are the same everything other than the actual variable names. All decimals and they all function properly. At least on the forms that use it, there are no UI policies attached that I didn't write and if I disable them, the same thing happens. It is very strange. Either way that error message is not from a script that I did and I don't see any others.

 

@bigbacon 

is that variable part of some variable set?

Did you try deactivating that variable and create a new one?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader