Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Order guide search pointing to catalog item

soumyadaggula
Tera Contributor

Hi Team , 

I have an order guide that is pointing to catalog item url 

soumyadaggula_0-1718101654737.png

I have gone through few community links , but unable to fix the issue. 

3 REPLIES 3

Mahathi
Mega Sage
Mega Sage

Hi @soumyadaggula ,

Not sure if you have already reviewed this post. 

Pasting the script for reference : 

 

Create on the order guide as an onLoad script


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]);  
    }  
}
}


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

 

This one seemed very close to what you asked for.

Please mark helpful and accept as solution if this answered your query.

 

Thanks,

Mahathi

@Mahathi 
Hello Mahathi , 
yes , I tried the above onload script , but somehow when I use this script , its changing the portal view/ background color .
Is there any other possible way to fix this ?

Mahathi
Mega Sage
Mega Sage

Hi @soumyadaggula ,

I found a KB Article but i think that is also redirecting to same script i had mentioned.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1213471

You can see if option 1 of the workaround works.

Please mark helpful and accept as solution if this answered your query.

Thanks,
Mahathi