
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 01:43 PM
We recently introduce a new "Manufacturer" field on the Case form.
Due to some reporting needs, we need to update all cases to assign this value; however, we cannot do this on Closed Cases.
- Is there any other way to update this "Manufacturer" field on Closed Cases?
See highlighted field on attached screenshot.
Thank you,
Mario
Solved! Go to Solution.
- Labels:
-
Customer Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 06:10 PM
You can do it using fix script or background script. Make sure to change value of manufacturer.
var gr = new GlideRecord("sn_customerservice_case");
gr.addQuery("state", 3);
gr.addQuery('u_manufacturer', '');
gr.query();
while (gr.next()) {
gr.u_manufacturer = 'Apple';
gr.autoSysField(false);
gr.setWorkflow(false);
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 06:10 PM
You can do it using fix script or background script. Make sure to change value of manufacturer.
var gr = new GlideRecord("sn_customerservice_case");
gr.addQuery("state", 3);
gr.addQuery('u_manufacturer', '');
gr.query();
while (gr.next()) {
gr.u_manufacturer = 'Apple';
gr.autoSysField(false);
gr.setWorkflow(false);
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 06:28 PM
Mike Patel's answer is spot on!
The only caveat I'd add for clarity is that you would might need an Admin to setup and execute the script for you, if you are not an administrator on the instance.
You might also need to consider how many closed records that you need to update; if there are a few thousand records, no problem. If there are 50-100k closed records you might see some performance impact from this kind of script. You could potentially mitigate some of that using GlideRecord's Update Multiple; there's a good article about it here
Hope this helps!
If this was helpful or correct, please be kind and click appropriately!
Michael Jones - Proud member of the CloudPires Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 07:53 PM
I appreciate the information.
I am an admin, but new to ServiceNow. We have about 1,500 closed Cases where the Manufacturer field is empty and it needs to be updated with multiple of the 25 Manufacturers we have.
I just exported the list of Closed Cases with empty Manufacturer, and passed it to the superuser in charge to populate the corresponding Manufacturer.
I am planing to use the Update option form the "Import external data into Case" functionality. This is under the "Import" selection when you Right-click any header of a list to open context menu (see attached image).
- Is this a good option to use?
Thank you,
Mario
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2020 08:22 PM
That would absolutely work and for that number of records might be even easier that writing a script.
One caveat, depending on the length of the name of the records you have in the manufacturer field; the default import tables that are created when you use this method have a habit of truncating things at 32 characters.
So, if you find you get errors that no matching values were found, you might need to adjust the max length on the fields if the values you are passing are more than 32 characters.
Otherwise, should work like a charm! Always try your import first in a non-prod instance or, if that is not an option, try small batches at first before you wade in for the whole list.
Good luck!
If this was helpful or correct, please be kind and click appropriately!
Michael Jones - Proud member of the CloudPires Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!