- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2018 11:49 AM
There is a user-defined field on the Contract form called PO amount (purchase order amount). It was defined as a string (this was done long ago). I have a requirement to convert this to a currency field, since this type of field allows the selection of the currency, which would obviously be very handy for fields that contain monetary values.
I cannot simply change the type to currency as ServiceNow will not allow selection of the Currency type when trying to change a String type, which makes sense since a string can contain non-numeric values and would not convert.
I did however verify that there are no non-numeric values in this string field. Is there a way to do this conversion?
The only way I could think of so far is to use a fix script to copy the field and the sys_id of each record to a holding table. Drop the PO amount field, recreate it as a currency field, then copy the values back into the new field from the holding table.
Ric
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2018 07:20 PM
Ric,
You are right(last paragraph), according to me the safest way to handle this would be to use a fix script or a background script.
Converting to different field type can corrupt the field which is much more worse.
So a Fix/background script that would :
1. Copy the values and sysIds of all the records in a JSON format and stores it somewhere(log it)
2. Drop the field
3. Create a new field with the same name(this important as there might be scripts that depend on the field name directly)
4. Move the data into the new field. The above steps can be tweaked according to your needs.
Thank you,
Aman Gurram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2018 07:20 PM
Ric,
You are right(last paragraph), according to me the safest way to handle this would be to use a fix script or a background script.
Converting to different field type can corrupt the field which is much more worse.
So a Fix/background script that would :
1. Copy the values and sysIds of all the records in a JSON format and stores it somewhere(log it)
2. Drop the field
3. Create a new field with the same name(this important as there might be scripts that depend on the field name directly)
4. Move the data into the new field. The above steps can be tweaked according to your needs.
Thank you,
Aman Gurram