Reload form after abort action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2017 06:00 PM
Team - I have been reading the forums and trying to get a business rule to reload a form.
What I am attempting to do is;
- take the code from "Prevent Closure if Child Task is Active"
- if a user goes to close the problem and a problen task is still open they see the 2nd screen shot below
- As you can see the 2nd screen shot actually appears as if the ticket has closed
- What I am looking to achieve is a combination of the second screen shot (shows the error) combined with the ticket showing that it is still open.
My code in the before business rule is:
var gr = new GlideRecord('problem_task');
gr.addQuery('active','true');
gr.addQuery('problem',current.sys_id);
gr.query();
if (gr.next()) {
gs.addInfoMessage('Problem cannot be closed while problem tasks are still active.');
current.setAbortAction(true);
}
I assume it will be a couple of lines of code to redirect/reload the form but have been unsuccessdul so far - any thoughts?
So that the initial screen shot of the problem ticket is:
If the business rule kicks in
And if I reload the ticket through the UI action
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 08:50 PM
Hello Andrew,
I am facing the same issue. Did you gt a chance to fix this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2019 06:17 PM
I have fixed this same issue by implementing my response in the previous post:
(function executeRule(current, previous /*null when async*/) {
gs.addInfoMessage("Can't alter the priority from 1");
current.setAbortAction(true);
current.state = previous.state;
gs.setRedirect(current);
})(current, previous);
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2024 10:46 AM
bro but i think all below lines will ignore after
current.setAbortAction(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2024 10:48 PM
Not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2025 07:55 AM
Hi guys,
as I had the same issue, here the current kb article regarding this topic: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0539962
"gs.setRedirect() in combination with current.setAbortAction(true) not executed."
Last updated this year in march.
