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.

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