Apply onLoad change to all order guides

kim-lindgren
Kilo Sage

We have a problem with order guides not loading correctly if you try enter it from Suggested Results or Favorites in the ESC. It is the same problem that is descriped here:

 

https://www.servicenow.com/community/developer-forum/portal-search-experience-order-guide-sc-cat-ite...

 

The solution described in that thread works fine for individual order guides, but how can I apply it to all order guides without having to manually add the script to each one?

 

Basically, I need some kind of script that is not connected to any particular order guide, a script that runs whenever any order guide is opened.

 

The solution code from the thread may also have to be changed somehow for this to work, not sure how though as it is rather complex.

 

function onLoad() {
   //Type appropriate comment here, and begin script below
	var qury = getParameterValue("id");
	var sysId =getParameterValue("sys_id");
	//alert('ji--  '+qury);
	if(qury == "sc_cat_item"){
top.window.location = "/sp?id=sc_cat_item_guide&table=sc_cat_item&sys_id="+sysId
	}	
	
function getParameterValue(name) {  
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");  
    var regexS = "[\\?&]" + name + "=([^&#]*)";  
    var regex = new RegExp(regexS);  
    var results = regex.exec(top.location);  
    if (results == null) {  
        return "";  
    } else {  
        return unescape(results[1]);  
    }  
}
}

 

/Kim 

0 REPLIES 0