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

Further to my last message It does alert me with the ontime number without the comer but does not update the field with that number.


the field in service now where you are populating this number, what is its type?? make it string.


-Anurag

where you are trying to update that number? i mean which type of field.


Thanks


Indeed, just to explain, we are porting tickets from a legacy system into ServiceNow. We want the onTime ref number to populate a read only string field called on time reference, When mapping the fields the information moves over fine however the a comer is added to the field, this does not exist on the spread-sheet so its something that ServiceNow is adding. I have tried the suggestions on this thread, all of which makes sense but none of them seem to work.



Just to clarify my last response, the alert I am getting is the number in the script, not the number in the field minus the comer, My mistake.



Regards


Lavlesh Garg1
Giga Expert

Steve,



See if it helps, I had the same issue and it worked for me.



Transform Maps Remove comma for on insert to string field



In case the import set table field also a String then you can try adding the below piece of code in the Script part of your Transform Map.



target.<string_field_name_in_target_table> = source.<string_field_name_in_import_set_table>.toString().replace(/,/g,'');