- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2022 07:56 AM
I have a after-update BR in which I am calling Server side script include function. ServiceNow is redirecting user to recently visited page after execution. I need to stop that and user should stay on the record itself. Any idea how to stop recirecting?
Here is the BR snippet:
(function executeRule(current, previous /*null when async*/) {
try {
gs.eventQueue('process.file',current,current.getUniqueValue(),gs.getUserName());
gs.addInfoMessage('File processing has been scheduled successfully.');
//above message appears on another page where user gets recirected.
} catch (e) {
gs.addErrorMessage('Error processing file.<BR>' + JSON.stringify(e));
current.setAbortAction(true);
}
})(current, previous);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2022 08:03 AM
Hi
you can try
var url = gs.generateURL(current.getTableName(), current.sys_id);
gs.setRedirect(url);
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2022 08:03 AM
Hi
you can try
var url = gs.generateURL(current.getTableName(), current.sys_id);
gs.setRedirect(url);
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2022 08:07 AM
That worked, should I do this at the end? Also, why SNOW was redirecting by default? is there any global property as I have other BRs and don't want to write repeatedly in all of them.
I mean, why we have to redirect to the same page? can't we just stop redirecting?