logo

NJP

Redirect URL - setRedirect function samples

Import · Dec 20, 2018 · article

Redirect Incident

var url = '/incident_list.do?sysparm_query=active=true%5Enumber%3DINC0000552';
gs.setRedirect(url);

Custom table

var url = '/u_your_table_list.do?sysparm_query=u_your_field%3DYourValue';
gs.setRedirect(url);

External URL

var url = 'https://www.globo.com';
gs.setRedirect(url);

Sets the redirect URI for this transaction, which then determines the next page the user will see.

Name Type Description
URI Object URI to set as the redirect
Type Description
void Method does not return a value

To use the setRedirect() method in a scoped application, use the corresponding scoped method: setRedirect().

Example

This example redirects the user to a particular catalog item, and passes along the current email as a parameter.

gs.setRedirect("com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=d41ce5bac611227a0167f4bf8109bf70&sysparm_user=" 
+ current.sys_id + "&sysparm_email=" + current.email)

Author:

Tiago Macul

Danilo Miyashita

image

Oficial Doc

gs.setRedirect() in combination with current.setAbortAction(true) not executed

Client & Server Code in One UI Action

SETREDIRECTURL AND SETRETURNURL

Redirect after session timeout

Was useful, please leave your feedback!

View original source

https://www.servicenow.com/community/itsm-articles/redirect-url-setredirect-function-samples/ta-p/2316791