How to redirect to portal using UI action

kumaraj
Kilo Sage

Hi All,

Greetings,

I have a requirement where I need to create an UI action on workspace on case form. When user open a case, click it then it should redirect the user to a catalog item form and pass that particular case number on catalog form filed "case number"

Catalog form name is - Order form

link to catalog item = https://abc123.service-now.com/csp?id=sc_cat_item&sys_id=89c4bd0f1b0455105f5bfd115b4bcb9a&referrer=popular_items

How can we achieve this, I mean what could the code?

 

3 REPLIES 3

Mohit Kaushik
Mega Sage
Mega Sage

Hi Kumaraj,

The redirection in your workspace UI action is in client side code or server side code?

If client side then below code can help you to redirect users.

var url ='/csp?id=sc_cat_item&sys_id=89c4bd0f1b0455105f5bfd115b4bcb9a&referrer=popular_items';
top.window.open(url);

If it is server side then below code should help you.

var url ='/csp?id=sc_cat_item&sys_id=89c4bd0f1b0455105f5bfd115b4bcb9a&referrer=popular_items';
action.setRedirectURL(url);

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

ColeM
Tera Expert

Hi, I had success with the following line of code in the workspace section of a client side UI action.  

 

location.replace('<Your URL here>');

Example_UI_Action.PNG

 

 

This is exactly what I needed. Thanks for the pic Cole!