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.

How to redirect the page when we clicked on service catalog item or how to put some link inside the catalog item.

mastanbe
Tera Contributor

Hello All,

I have requirement that, 

We have an existing catalog item like procurement  item , it contains some variables now due to migration now this catalog item is no more using so , 

Item owners want that endusers  clicked on the existing catalog item then it will redirect to new catalog item that is in new company portal.

So please suggest what I need to do on this requirement.

I have suggested , on description part or I create one label and put some these new link on form. I have some doughts on this if we inactivate the all existing variables, then the previous records will display those variables.

Please give me some guidance on this.

 

1 ACCEPTED SOLUTION

Harish KM
Kilo Patron
Kilo Patron

Hi you can have a onload client script on old catalog item. If they open old item on portal it will redirect them to new item

function onLoad() {
   var sys_ID = '65ea93ea074c5510f1cbf48f7c1ed034'; // old catalog item sysid
    
    if (sys_ID == '65ea93ea074c5510f1cbf48f7c1ed034')
        {
            location.href =" /sp?id=sc_cat_item&sys_id=08bd647507f50110f1cbf48f7c1ed01d"; //replace portal name, page id and item sysid
        }
   
}

Regards
Harish

View solution in original post

2 REPLIES 2

Harish KM
Kilo Patron
Kilo Patron

Hi you can have a onload client script on old catalog item. If they open old item on portal it will redirect them to new item

function onLoad() {
   var sys_ID = '65ea93ea074c5510f1cbf48f7c1ed034'; // old catalog item sysid
    
    if (sys_ID == '65ea93ea074c5510f1cbf48f7c1ed034')
        {
            location.href =" /sp?id=sc_cat_item&sys_id=08bd647507f50110f1cbf48f7c1ed01d"; //replace portal name, page id and item sysid
        }
   
}

Regards
Harish

Thanks Harish KM, your script  is working fine.