UI Script works in Dev but not executing in Prod

JLeong
Mega Sage

The script below works in Dev but for some reason is not executing when I moved it to Production. What am I missing?

 

(function() {

    //alert('click ok');
    var ECpilotUser = new GlideAjax('global.getUserInfo');
    ECpilotUser.addParam('sysparm_name', 'getUserRole');
    ECpilotUser.getXMLAnswer(portalRedirect)

})();

function portalRedirect(response) {
    var pilotUser = response;
    if(pilotUser=='true') {
        var path = window.location;
        //alert('path = ' + path);
        var newpath = path.toString().replace("/sp", "/esc");
        //alert(newpath);
        window.location.assign(newpath);
    } else {
        return;
    }
}

 

9 REPLIES 9

Sheldon  Swift
ServiceNow Employee
ServiceNow Employee

Hi @JLeong - How did you go about promoting the code from Development to Production? I would start by making sure that getUserInfo exists in Production, in the global scope, and is client callable. You might also confirm if the client script has "Isolate script" set to true.

Thanks Sheldon for responding to my question.

 

  1.  getUserInfo exists in Production - Yes
  2. global scope - Yes
  3. client callable - Yes
  4. Isolate script doesn't exist in UI Script

Swapna Abburi
Mega Sage
Mega Sage

Hi @JLeong 

Compare with Dev and see if this UI Script is missing in respective Portal Theme JS includes in Prod.

 

Hi Swapna, I am not sure how to do that. Could you please provide instructions.