Catalog Client scripts on order guides do not work in service portal since Jakarta Patch 9. There is no issue in back-office Native UI, when clicking on 'Try It' on the order guide.


Steps to Reproduce


1. Login a Jakarta Patch9 instance.

2. Open the order guide:

3. Observe there is a catalog client script that is written for this order guide:
4. Observe catalog client scripts are not executed.

5. Observe the issue does not occur in native UI:

6. The issue occurs on order guides in service portal: /sp?id=sc_cat_item_guide&sys_id=25110912372211003e7d40ed9dbe5dd6

7. Observe the issue is not seen for any client script on catalog items, record producers, and normal forms in service portal: 
- record producer on service portal: /sp?id=sc_cat_item&sys_id=eb0d5b18dbd21300e99236cb7c96194b
- incident form in service portal: /sp?id=form&table=incident&sys_id=8d641046c0a80164000bc7c0d3ed46a0


There is no workaround applicable. Please review the Fixed In version list to plan an upgrade to a patch containing the fix.

 There is a crude workaround for this if customer can't wait for the fix

  1. If you have a cloned widget already proceed to step 2, else clone the Order Guide widget sp_config?id=widget_editor&sys_id=4d062372ff130200ba13ffffffffffc4
  2. In the server script section, after the following line
        data.sc_cat_item = $sp.getCatalogItem(data.sys_id, true);
    Add the following workaround

    a) Fetch all variable sets for Catalog item.
    b) Fetch all client scripts on Variable sets
    c) Push all client scripts.


//Workaround: - PRB1287069 
var onChangeCount = data.sc_cat_item.client_script.onChange.length, 
onSubmitCount = data.sc_cat_item.client_script.onSubmit.length, 
onLoadCount = data.sc_cat_item.client_script.onLoad.length; 
// TODO, hot fix should self-de-activate when SN fixes bug 
if (onChangeCount === 0 && onSubmitCount === 0 && onLoadCount === 0) { 
// it's unlikely that we didn't have any client scripts, let's see if there's a bug 
// and add them back manually if so 
// get all catalog client scripts for this cat item 
var grClientScripts = new GlideRecord('catalog_script_client'); 
grClientScripts.addQuery('cat_item', data.sys_id); 
while (grClientScripts.next()) { 
//console.log('found script: ' + grClientScripts.name); 
var clientScriptType = grClientScripts.type.toString(); 
// TODO: skip adding client scripts if already added (by SN platform) 
// add the missing scripts manually 
fieldName: getFieldName(grClientScripts.cat_variable.toString()), 
name: grClientScripts.name.toString(), 
script: grClientScripts.script.toString(), 
sys_id: grClientScripts.sys_id.toString(), 
tableName: "" 
// Start workaround for Variable sets 
var grVariableSets = new GlideRecord('io_set_item');
grVariableSets.addQuery('sc_cat_item', data.sys_id); 
while (grVariableSets.next()) {
var variableSetSysId = grVariableSets.variable_set.toString();
//console.log("Variable Set Sys ID:- "+variableSetSysId);
var grClientScriptsVarSet = new GlideRecord('catalog_script_client');
grClientScriptsVarSet.addQuery('variable_set', variableSetSysId); 
while (grClientScriptsVarSet.next()) { 
//console.log('found script: ' + grClientScripts.name); 
var clientScriptType = grClientScriptsVarSet.type.toString(); 
// TODO: skip adding client scripts if already added (by SN platform) 
// add the missing scripts manually 
fieldName: getFieldName(grClientScriptsVarSet.cat_variable.toString()), 
name: grClientScriptsVarSet.name.toString(), 
script: grClientScriptsVarSet.script.toString(), 
sys_id: grClientScriptsVarSet.sys_id.toString(), 
tableName: "" 
// End workaround for variable sets
function getFieldName(ioName) { 
return data.sc_cat_item._fields[ioName].variable_name; 
// End workaround 
Test the workaround in dev instance and push to prod.
Please remember to remove the workaround after JP10 or KP7 upgrade.

Related Problem: PRB1287069

Seen In

Jakarta Patch 9

Fixed In

Jakarta Patch 10
Jakarta Patch 9 Hot Fix 4
Kingston Patch 6 Hot fix 5
Kingston Patch 7

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-09-04 08:04:03