- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 03:31 PM
We defined a field as an integer. It needs to be of type percent_complete.
We tried to change it but ServiceNow won't allow the change.
Worst case is to export existing values. Drop the column and create a new one and reimport the data.
Other option is to create another column Percent Complete as type Percent Complete and copy the existing values to that column.
That will require many changes to forms, reports, arrrgghhhh.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 03:35 PM
Hi Mike,
There are some field types you cannot (and do not want to) convert from/to. This seems to be one of them. Doing so could endanger the data.
The safest approach is to create a new field and copy over the old one. Sorry about the extra work.
Let us know if you need help copying the old values to the new. A one time script in scripts background would do the trick. It would look something like this:
(function () {
var rec = new GlideRecord('YOUR_TABLE');
rec.query();
while (rec.next()) {
rec.u_percent = rec.getValue('u_integer'); // update field names accordingly
rec.setWorkflow(false); // don't trigger workflows or business rules
rec.autoSysFields(false); // don't update updated/update on/mod count
rec.update();
}
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 03:35 PM
Hi Mike,
There are some field types you cannot (and do not want to) convert from/to. This seems to be one of them. Doing so could endanger the data.
The safest approach is to create a new field and copy over the old one. Sorry about the extra work.
Let us know if you need help copying the old values to the new. A one time script in scripts background would do the trick. It would look something like this:
(function () {
var rec = new GlideRecord('YOUR_TABLE');
rec.query();
while (rec.next()) {
rec.u_percent = rec.getValue('u_integer'); // update field names accordingly
rec.setWorkflow(false); // don't trigger workflows or business rules
rec.autoSysFields(false); // don't update updated/update on/mod count
rec.update();
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:10 AM
If we create a new field called temp_complete and copy complete over to temp_complete can we then delete complete and then recreate complete in the new format and copy temp_complete over to complete? What I am wondering is if all of the reports, lists, ACLs, etc. will reattach to the new field with the old name or if we will need to go in and recreate all that?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:14 AM
Hi Mike,
What I have found in many cases is that if you do this from the dictionary (not from form layout or form designer) reports and form layouts and all those other things remember where the old field name goes. I haven't done it in a while, so test.
Summary: Deleting a field from the dictionary and re-creating it USUALLY can be done transparently.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 03:37 PM
Hi Mike,
Best practice : Instead of changing a field's type, create a new field with the correct type and migrate the data from the old field to the new field and, optionally, delete the original field.
Please refer section 3.1.4 for more info.