removing commas in numbers

scottjus82
Kilo Guru

Morning all,

I am importing some data from an old system into ServiceNow, the reference number from the previous system will go into a custom field in ServiceNow. This is working however it is adding a comma so the number becomes 32,546 instead of 32546. How do I stop this happening?

Regards

19 REPLIES 19

Harish Murikina
Tera Guru

while doing that before inserting you can change the value and update.


EX:



var str = '32,546';


var res = str.replace(",", "");


alert(res);


Hey all,



I have tried all three of the above and I cant get any working.



Any thoughts?



Thanks


hi



try this.



var removed = '';


var str = '32,546';


var res = str.split(',');


for(var i=0; i<res.length; i++)


{


removed   += res[i];


}


alert(removed);



Thanks


Basha


HI,



Thanks for the quick response, can you confirm if this is in a client script?


Yep