I have retired a catalog item.

Taaha M
Tera Contributor

The  catalog item is being retired. As such, we need to identify and remove any references to the item within other item Descriptions, variables, etc.

So i need a script which which help me in identifying all references to the  catalog item, either by name or direct hyperlink, are identified within any Catalog Item Description, or within any field in a Catalog Item, or any client scripts

3 REPLIES 3

Arun_Manoj
Mega Sage

Hi @Taaha M ,

Could you please rephrase for question.

Thanks

Arun

I have made a catalog item inactive.
Now i want to check if in any of the existing catalog items , catalog scripts or variables I have used any hyperlink of the inactivated catalog item.

So I am looking for script that can help me 

Hi @Taaha M ,

  1. Catalog Items: Query the sc_cat_item table to find catalog items that contain references to the inactive catalog item.

  2. Catalog Variables: Query the sc_cat_item_option and sc_cat_item_option_mtom tables to find catalog variables that reference the inactive catalog item.

  3. Catalog Scripts: Search through catalog client scripts, catalog UI policies, and catalog client scripts for occurrences of the hyperlink to the inactive catalog item.

 
var inactiveCatalogItemId = 'YOUR_INACTIVE_CATALOG_ITEM_SYS_ID'; // Search for references in catalog items var catalogItemGr = new GlideRecord('sc_cat_item'); catalogItemGr.addQuery('description', 'CONTAINS', inactiveCatalogItemId); catalogItemGr.query();
while (catalogItemGr.next()) {
gs.info('Catalog Item with sys_id ' + catalogItemGr.sys_id + ' contains reference to inactive catalog item.');
} // Search for references in catalog variables
var catItemOptionGr = new GlideRecord('sc_cat_item_option'); catItemOptionGr.addQuery('reference_qual', 'CONTAINS', inactiveCatalogItemId); catItemOptionGr.query();
while (catItemOptionGr.next()) {
gs.info('Catalog Variable with sys_id ' + catItemOptionGr.sys_id + ' contains reference to inactive catalog item.');
} // Search for references in catalog client scripts
var catalogClientScriptGr = new GlideRecord('catalog_script_client'); catalogClientScriptGr.addQuery('script', 'CONTAINS', inactiveCatalogItemId); catalogClientScriptGr.query();
while (catalogClientScriptGr.next()) {
gs.info('Catalog Client Script with sys_id ' + catalogClientScriptGr.sys_id + ' contains reference to inactive catalog item.');
}