How to redirect to new tab/window from catalog client script

Anurag28
Kilo Contributor

Hello all,

 

We have a catalog item with Multiple choice variable. If user clicks on one option, it should redirect user to a new request template. From onchange Client Script here is how I am trying to redirect-

 

else if(ag == 'SPIL Issue'){
var url = 'https://xxxxx.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?v=1&&sysparm_id=28380818db6bcc902a862aea4b9619d1';
top.window.open(url);//,'','width=800,height=700');
}

 

top.window.open() indeed works but it opens the new tab in navpage view, not opening in portal view for end users. This might be happening becuase of hard coding of the url. Any idea how I can rectify this?

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Anurag,

you can try this

var url = '/sp?id=sc_cat_item&sys_id=28380818db6bcc902a862aea4b9619d1'
top.window.open(url);//,'','width=800,height=700');

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

I imagine, this would by default then take everyone to portal view, no? In our environment we have multiple portals depending on users company as well as nav page view for itil users. I wanted something that would take users to new view depending on their access in the environment. like if end user,go to end user view, if itil user, go to navpage view like this.

 

Much appreciated!

Prateek kumar
Mega Sage

Take a look at below:

https://community.servicenow.com/community?id=community_blog&sys_id=cbcda2e9dbd0dbc01dcaf3231f961949

 

Please mark my response as correct answer and helpful if it helped solved your question.

-Best Regards

Prateek kumar


Please mark my response as correct and helpful if it helped solved your question.
-Thanks