- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2020 10:13 AM
Hi - I was searching for a way to export catalog items from an instance similar to the solutions here:
- https://community.servicenow.com/community?id=community_question&sys_id=75ad1c8edb4e2340f0612183ca96...
- https://www.servicenowguru.com/system-definition/exporting-service-catalog-items-step/
However, both solutions no longer work in Orlando.
Is there a new solution out somewhere?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 10:13 AM
So, if I understand correctly you were able to export the XML & having issues importing it in some other instance.
If so, it does not matter where you import from as system will just consider XML values & get it imported in required table.
So, simply open an list view. For instance, simply open Incident list view as below & get the XML file that you exported from other instance imported here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 10:21 AM
Instead of doing this manually, you should create update set and capture these catalog items, variables, workflow etc in your update set and move update set from one instance to another.
IF you don't have catalog items in update set, then follow below blog solution to capture catalog items objects in current update set.
https://community.servicenow.com/community?id=community_blog&sys_id=e16dea29dbd0dbc01dcaf3231f961913
This will be cleaner and better approach.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 10:26 AM
The catalog items and workflows were already built on a different Service-Now instance so capturing this in an update set means that we have to rebuild it. Am I right?
We don't have copies of the update set and the previous administrator didn't keep it in a clean and easily understood way.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 10:44 AM
You don't have to rebuild any catalog items.
Create a new update set and select this update set and then run fix script mentioned in https://community.servicenow.com/community?id=community_blog&sys_id=e16dea29dbd0dbc01dcaf3231f961913
blog to capture catalog items, workflows, variables etc for your existing catalog items in your current update set.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 11:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2020 02:46 PM
Use below code and run as fix script
Make sure that you pass your catalog item sys_id in line no 4 for catalog_item_sys_id
// push a catalog item and all its components to the active update set
// in test mode, no records will be saved to update, only script output of matching records
var test_mode = false;
var catalog_item_sys_id = 'f8861cbedbed73008d73771c8c961961'; // my catalog item
var captureVariables = function(p_sys_id, p_variable_set, p_test_mode) {
if (typeof p_test_mode !== 'boolean') {
p_test_mode = false;
}
if (typeof p_variable_set !== 'boolean') {
p_variable_set = false;
}
if (JSUtil.notNil(p_sys_id)) {
var item = new GlideRecord('item_option_new');
if (p_variable_set) {
item.addQuery('variable_set', p_sys_id);
} else {
item.addQuery('cat_item', p_sys_id);
}
item.query();
while (item.next()) {
gs.print('add variable question to update set: ' + item.name)
if (!p_test_mode) {
item.setForceUpdate(true);
item.update();
}
// Query for question choices for variables
var qc = new GlideRecord('question_choice');
qc.addQuery('question', item.sys_id.toString());
qc.query();
while (qc.next()) {
//Add the variable question choice to the update set
gs.print(' add variable question choice to update set: ' + qc.text)
if (!p_test_mode) {
qc.setForceUpdate(true);
qc.update();
}
}
}
}
};
var captureUIPolicies = function(p_sys_id, p_variable_set, p_test_mode) {
if (typeof p_test_mode !== 'boolean') {
p_test_mode = false;
}
if (typeof p_variable_set !== 'boolean') {
p_variable_set = false;
}
if (JSUtil.notNil(p_sys_id)) {
var catpol = new GlideRecord('catalog_ui_policy');
if (p_variable_set) {
catpol.addQuery('variable_set', p_sys_id);
} else {
catpol.addQuery('catalog_item', p_sys_id);
}
catpol.query();
while (catpol.next()) {
gs.print('add UI Policy to update set: ' + catpol.short_description)
if (!p_test_mode) {
catpol.setForceUpdate(true);
catpol.update();
}
//Query for ui policy actions
var uipact = new GlideRecord('catalog_ui_policy_action');
uipact.addQuery('ui_policy', catpol.sys_id.toString());
uipact.query();
while (uipact.next()) {
gs.print(' add UI Policy Action to update set: ' + uipact.variable + '-' + uipact.ui_policy.short_description)
if (!p_test_mode) {
uipact.setForceUpdate(true);
uipact.update();
}
}
}
}
};
var captureCatalogClientScripts = function(p_sys_id, p_variable_set, p_test_mode) {
if (typeof p_test_mode !== 'boolean') {
p_test_mode = false;
}
if (typeof p_variable_set !== 'boolean') {
p_variable_set = false;
}
if (JSUtil.notNil(p_sys_id)) {
var catclntscr = new GlideRecord('catalog_script_client');
if (p_variable_set) {
catclntscr.addQuery('variable_set', p_sys_id);
} else {
catclntscr.addQuery('cat_item', p_sys_id);
}
catclntscr.query();
while (catclntscr.next()) {
gs.print('add catalog client scripts to update set: ' + catclntscr.name);
if (!p_test_mode) {
catclntscr.setForceUpdate(true);
catclntscr.update();
}
}
}
};
// 1. capture catalog item record
var gr1 = new GlideRecord('sc_cat_item');
if (gr1.get(catalog_item_sys_id)) {
gs.print('add catalog item to update set: ' + gr1.name)
if (!test_mode) {
gr1.setForceUpdate(true);
gr1.update();
}
captureVariables(catalog_item_sys_id, false, test_mode);
captureUIPolicies(catalog_item_sys_id, false, test_mode);
captureCatalogClientScripts(catalog_item_sys_id, false, test_mode);
//5. capture related variable sets
//Query for variable set relationships
var vsrel = new GlideRecord('io_set_item');
vsrel.addQuery('sc_cat_item', catalog_item_sys_id);
vsrel.query();
while (vsrel.next()) {
gs.print('add variable set relationship to update set: ' + vsrel.variable_set.name);
if (!test_mode) {
vsrel.setForceUpdate(true);
vsrel.update();
}
// capture variable set
var vs = vsrel.variable_set.getRefRecord();
if (JSUtil.notNil(vs)) {
//vs.sys_id);
captureVariables(vs.sys_id, true, test_mode);
captureUIPolicies(vs.sys_id, true, test_mode);
captureCatalogClientScripts(vs.sys_id, true, test_mode);
}
}
}