Business Rule gs.setRedirect not working after re-opening an incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2012 02:09 PM
I have a business rule that is called AFTER an UPDATE to the "incident" table.
The script that gets called is simply:
gs.setRedirect('https://zzz.service-now.com/ess');
I have also put this line above the redirect so I can see if it is getting called:
gs.addInfoMessage("This business rule is running.");
This works fine if I UPDATE or I RESOLVE the incident.
However, when I RE-OPEN the incident, the redirect does not work. I can see that the business rule is running by the info message, but I never get redirected like I do for an UPDATE or RESOLVE.
I've tried setting the "order" to 50 and also to 1,010. That did not change anything.
Is there anything that I can do to get this redirect to work properly?
Is there any way that I could see what could possibly be blocking it from redirecting?
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2012 04:25 PM
What exactly do you mean by "re-open" the incident? Do you have a Re-Open UI Action that re-opens the ticket for you? Or do you mean you set the State to Active and select Save? The global Save UI Action has a line of code in it (action.setRedirectURL(current)) that tells the UI to redirect back to itself, overriding any redirect you may be doing in the Business Rule. The Update UI Action does not do a re-direct so that is why the Update re-directs to the ESS.
Now for something really weird, try this out - with your Business Rule still active, make a change to an Incident record in the List View and then click on a link in either the Bookmark bar, Navigator or Banner. What happens? You will end up being re-directed to the ESS Portal homepage. I have it setup in demo15. Even doing a Global Search after a change to an Incident record will re-direct to the ESS Portal. 🙂
What I'm trying to show is you are mixing two completely different layers. Business Rules can basically be thought of as database triggers - they are fired when a database operation occurs, not because a user clicked on something in the browser, although that is what seems to happen. But in reality, the user clicks the Update button and it tells the system to save the record, which in turn kicks off the Business Rule. You'll want to do the re-direction in the UI side of the platform, so in a UI Action instead of in a Business Rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2012 11:18 AM
Jim,
I really appreciate your help! I have had no ServiceNow training and I am trying to learn by basically reverse-engineering how things work.
I've been reading through the UI Action documentation on the wiki pages, but I am still a bit confused and hope you can point me in the right direction.
I am attaching a screenshot of one of our pages. What I would like to do is to add a UI Action to the "Update" and to the "Resolve Incident" buttons so that I can add a pop-up message and also redirect the user to our main /ess site.
I am very thankful for any help that you are able to offer, thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2012 08:53 AM
It is possible to do what you want, but we need to be careful. For instance, you probably only want to re-direct if the user is currently in the Portal, correct? You would not want your "itil" users to be re-directed to the ess site while they are updating tickets in the "regular" UI. That is an issue because the UI Actions ("Update" and "Resolve Incident" buttons) will appear in both interfaces. They are the same buttons, but code can be added to resolve that.
What if the users were looking at a list of their incidents, clicked on one and added some information. If they click on "Update", it should go back to the list of incidents, should it not? Or do you always want to force them to the homepage? Doing that makes the interface cumbersome because they would then have to click on another link to get to their list of incidents again. The "Update" button, by design, is suppose to bring the user back to the previous page they were viewing.