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.

Redirect catalog item requests through UI script.

vasantha Teja
Tera Contributor

Hi All, 

I need small help, when a user (particular group) clicks on the Hardware catalog item  it will redirect to the office catalog item by using Ui script, I'm using the below UI script ..

(function() {
    var ur1 = window.location.href;
    //check the user is member of CAB Approval
    if (gs.getUser().isMemberOf('b85d44954a3623120004689b2d5dd60a')) {
        // Check the user is on a service portal link
        if (url.indexOf('now.com/sp') != -1) {
            // If so, play swapsies.
            ur1 = ur1.replace('/sp', '/sp');
            ur1 = ur1.replace('?id=sc_category', '?id=sc_category');
            // Send them away!
            // ur1 = ur1.replace('&sys_id=d258b953c611227a0146101fb1be7c31', '&sys_id=109cdff8c6112276003b17991a09ad65');
            // ur1 = ur1.replace('&catalog_id=-1', '&catalog_id=-1');
            // ur1 = ur1.replace('&spa=1', '&spa=1');
            window.location.assign(ur1);
        }
    }
})();

Thanks in Advance!

Teja.

0 REPLIES 0