Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

How to allow decimal values in integer field

Siri8
Kilo Contributor

In a Integer type field it should allow decimal values as well.I have followed below script but it is not accepting decimal values

Client Script : onChange

function onChange(control, oldValue, newValue, isLoading, isTemplate)

{

if (isLoading || newValue === '')

{
return;
}
var reg = /^[0-9]*\.[0-9]{2}$/;
var ans = g_form.getValue('field_name');
if(!reg.test(ans))
{
g_form.clearValue('field_name');
}
}

5 REPLIES 5

Hi all,

 

how to convert decimal to number ?

 

 

thanks niranjan