2010 views

Description

If a new variable or UI policy is added to an existing catalog item, fulfillers still working on existing requested items see the following error:

TypeError: g_form.getAppliedFieldName is not a function

Uncaught TypeError: g_form.getAppliedFieldName is not a function
GlideFieldPolicy._debugAction @ ui_policy.jsx?v=04-09-2016_1519:722
GlideFieldPolicy._runAction @ ui_policy.jsx?v=04-09-2016_1519:619
GlideFieldPolicy.runActions @ ui_policy.jsx?v=04-09-2016_1519:577
GlideFieldPolicy.runPolicy @ ui_policy.jsx?v=04-09-2016_1519:37
GlideFieldPolicy.runPolicyOnLoad @ ui_policy.jsx?v=04-09-2016_1519:32
ui_policy_onLoad @ ui_policy.jsx?v=04-09-2016_1519:741
runBeforeRender @ js_includes_doctype.jsx?v=04-09-2016_1519&lp=Tue_May_24_10_48_15_PDT_2016&c=4_62:404
(anonymous function) @ z_last_include.js:10
(anonymous function) @ z_last_include.js:16

Steps to Reproduce

  1. Create a new catalog item.
  2. Add several variables to the item.
  3. Add a UI policy on any of the variables.
  4. Order the item.
    Note that the variables are visible in the requested item.
  5. Add a new variable to the item.
  6. Update the UI policy with the new variable.
  7. Open the old requested item.
    Error message is displayed.

Workaround

There is no known workaround for this issue. If you are able to upgrade, review the Fixed In field below to determine the versions that have a permanent fix. You can also subscribe to this known error article (click Subscribe button at the top of the article) to receive notifications when more information is available about this issue.  

The root cause of this issue is that there are broken references to variables in the Catalog UI Policies. If you encounter this situation, instead of having to go through all the Catalog UI Policy Actions to find the broken reference, you can use the following script to find ALL the broken variable references for you and print out the URL for the list of the catalog ui policy actions that were found to have broken references:

 

/************************************************************************

*   Find Broken Catalog UI Policy Action references

*

*    Purpose:

*        If a catalog task shows that it is broken due to

*        an error in the developer tools pointing to ui_policy.js

*        you can use this script to find which Catalog UI policy

*        Actions are showing up as broken references in the

*        catalog_ui_policy_action table. 

*

*    Output:

*        sys_id of orphaned record

*************************************************************************/

function findBrokenPolicies() {

 
    var cupaIDStr = "";

    var gr = new GlideRecord('catalog_ui_policy_action');
    gr.addActiveQuery();
    gr.query();  //Query the entire list of catalog UI Policy Actions to find the catalog_variable value

    while (gr.next()) {

        var cv = gr.catalog_variable.getDisplayValue();
        var sID = cv.split('IO:')[1];  // Remove the IO: from the value in the catalog_variable IE: IO:d4892e556f081d00362401dfde3ee496 
        var upaName = gr.sys_name;
        var upaID = gr.sys_id; 
        var gr2 = new GlideRecord('item_option_new');
        gr2.addActiveQuery();

        if (!gr2.get(sID)) {
            cupaIDStr += upaID + ","; // If the queried record does not exist, we add it to the cupaIDStr (cupa = Catalog UI Policy Action)
        }

        gr2 = new GlideRecord('sc_item_option_mtom');
        gr2.addQuery('sc_item_option.item_option_new.sys_id', sID);
        gr2.query();

        if (!gr2.next()) {
            cupaIDStr += upaID + ","; // If the queried record does not exist, we add it to the cupaIDStr (cupa = Catalog UI Policy Action)
        }

    }
 
    var cupaIDList = cupaIDStr.substring(0, cupaIDStr.length - 1);   

    // If a match is found, we print out the URL, else we print out no matches found

    if (cupaIDList.length > 0) {
        gs.print("Catalog UI Policy Actions with broken references can be found in the following location: ");
        var cupaURL = "/catalog_ui_policy_action_list.do?sysparm_query=sys_idIN" + cupaIDList + "&sysparm_first_row=1&sysparm_view=";
        gs.print(cupaURL);
    } else {

        gs.print("No matches found in the Catalog UI Policy Actions table");
    }
}

 


Related Problem: PRB686241

Seen In

Eureka Patch 12
Eureka Patch 13 Hot Fix 2
Fuji Patch 12 Hot Fix 1
Fuji Patch 13 Hot Fix 1
Fuji Patch 7 Hot Fix 16
Geneva Patch 1 Hot Fix 8
Geneva Patch 3 Hot Fix 2
Geneva Patch 4
Geneva Patch 5
Geneva Patch 6 Hot Fix 2
Helsinki Patch 0 Hot Fix 1
Helsinki Patch 0 Hot Fix 3
Helsinki Patch 1
Helsinki Patch 2
Helsinki Patch 3
Helsinki Patch 4

Fixed In

Helsinki Patch 1 Hot Fix 1
Helsinki Patch 2 Hot Fix 2
Helsinki Patch 3
Istanbul

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-05-15 12:49:21
Published:2016-07-01