- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 02:48 AM
Hi,
I want to redirect to some given URL by clicking on the 'Initiated Request Button' based on the selection of
Task Type(drop down).
Script:
function redirectBasedOnTaskType() { // Get the current task record
var currentRecord = g_form.getTableName("x_bpin_ds_advisory_activity"); // Define the URL based on the task type var sn_redirectUrl = ''; if (currentRecord == 'x_bpin_ds_advisory_activity') { // Redirect URL for tasks sn_redirectUrl("ttps://go.bp.com/nbjty");
}
else if (currentRecord == 'x_bpin_ds_advisory_activity') { // Redirect URL for tasks sn_redirectUrl("https://go.bp.com/rHUZg"); } // Redirect the user to the URL } // Call the function when the button is clicked redirectBasedOnTaskType();
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 08:04 AM
Hi,
I am able to resolved my issue by using the script as mentioned below.
var tasktype = current.task_type;
if (tasktype == "Web app scan") {
action.setRedirectURL(http://www.xxxxx.com/mxxxxx.htm);
}
if (tasktype == "Infrastructure scan") {
action.setRedirectURL(http://www.xxxxx2.com/mxxxx2.htm);
}
if (tasktype == "Mobile penetration test") {
action.setRedirectURL(http://www.xxxx3.com/mxxxx3.htm);
}
else if (tasktype == "Review by security architecture board") {
action.setReturnURL(current);
action.setRedirectURL(current);
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 02:58 AM
in client side you can redirect using g_navigation
g_navigation.open(url, '_blank'); // you can open in new tab or same tab
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 08:04 AM
Hi,
I am able to resolved my issue by using the script as mentioned below.
var tasktype = current.task_type;
if (tasktype == "Web app scan") {
action.setRedirectURL(http://www.xxxxx.com/mxxxxx.htm);
}
if (tasktype == "Infrastructure scan") {
action.setRedirectURL(http://www.xxxxx2.com/mxxxx2.htm);
}
if (tasktype == "Mobile penetration test") {
action.setRedirectURL(http://www.xxxx3.com/mxxxx3.htm);
}
else if (tasktype == "Review by security architecture board") {
action.setReturnURL(current);
action.setRedirectURL(current);
current.update();
}