catalog item url redirection

Vinya Jakkula
Tera Contributor
1 ACCEPTED SOLUTION

Hi @Vinya Jakkula 

 

As asked by you below is the code that the functionality will not affect admins

var redirectionOccurred = false;
function onLoad() {
	redirectionOccurred=false;
   
    if (!g_user.hasRole('admin') && !redirectionOccurred) {
        alert("You will be redirected");
        var url = 'https://dev243190.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=f5d8d3f6e8b721004ece55c82c089cc6';
        if (url) {
            // Redirect to the new URL
            top.window.location = "https://dev243190.service-now.com/sp?id=sc_cat_item&sys_id=f5d8d3f6e8b721004ece55c82c089cc6&referrer=recent_items";
            
           
            redirectionOccurred = true;
           
        }
    }
}

 

Thanks and Regards

Sai Venkatesh

View solution in original post

10 REPLIES 10

SAI VENKATESH
Tera Sage
Tera Sage

Hi @Vinya Jakkula 

 

You can try the below Script 

(function executeRule(current, previous /*null when async*/) {
    if (current.uri == 'com.glideapp.servicecatalog_cat_item_view.do') {
        current.setRedirectURL('https://dev184220.service-now.com/sp?id=sc_cat_item&sys_id=3a25637b47701100ba13a5554ee490a0');
    }
})(current, previous);

 

Thanks and Regards

Sai Venkatesh

Hi @SAI VENKATESH  

Thanks for reply. Which table I need to use and what type of BR let me now please.

Hi

 

you can use sc_cat_item table

 

Thanks and Regards

Sai Venkatesh

It is not working @SAI VENKATESH