What's the alternative for setRedirectURL in the new Service Portal?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2016 09:27 PM
Hi guys
I'm trying to set up a UI action button to redirect the user to a different URL in the service portal.
Traditionally, I would use the setRedirectURL method for this.. but this doesn't seem to work anymore in the new service portal!
I've digged up the documentation and found..
UI Actions
All Server-side UI Actions are supported, with one important distinction - setRedirectURL() operations are ignored, due to the fact that Service Portal forms do not handle redirection the same way that forms in the platform do.
this is from documentation/form.md at 7ff41f14c1b9e2525347160577b322300b7ed5a3 · service-portal/documentation ·...
If so, then what's the alternative way to redirect the user to a different URL?
Please share if you know.. Thanks
Regards
Kevin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2018 04:35 AM
Hi Kevin,
You can try using window.location='url'; in client part of UI Action.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2018 04:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2018 06:02 AM
Read somewhere that window is null for Service Portal & hence it fails.
Can you try top.location . Alternatively you may refer thread.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2018 05:15 AM
Here's the way I do it. Not sure if it's officially correct, but hey - it works!
In the client script, I use:
$scope.goToUrl = function(url) {
$location.url(url);
}
In the HTML, I have a button with an ng-click that looks like this to go to the next record:
<button class="btn btn-primary"s ng-click="goToUrl(data.nav.prev)">
<span class="myDefault glyphicon glyphicon-arrow-left"></span>
</button>
The data.nav.prev is calculated in the server script by a script include function, but it ultimately comes out as a relative URL. e.g. ?id=some_widget?sysparm_foo=bar.