action.setRedirectURL in Client Scripts.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2018 04:14 AM
I have UI Action button I want to trigger
var url='/myurl.do' ;
action.setRedirectURL(url);
The UI Action triggers, but it will not load my URL
action.setRedirectURL(url); works from my UI page ClientsScript but not from the UI Action.
Is there another way to solve this.
Showing a dialog in not an option.
A new window could work, but preferable the main window.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2018 06:45 AM
Hi,
Can you please confirm that you are using your UI action on server side as action.setRedirectURL() is a server side function. But, if you are using UI action on client side you either need to manipulate window.location object or enhance your UI Action and make it capable of executing both client-side and server-side code.
If the response is useful, mark the post correct and helpful.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 12:42 AM
Ok to summarize this;
I have a UI Action adding av button on a form;
The button works fine and triggers this i the script as of now...
function show_print_dialog(){
var status_report = g_form.getValue('number');
var url = 'https://axtest.service-now.com/nav_to.do?uri=%2Fui_page.do%3Fsys_id%3D4189bcecdb85df40f439b6bffe961996';
alert(url);
window.location = url;
//location.href = url;
//alert('ping');
}
Using windows.location or location.href results in that the page reloads but i ends up on the page;
https://axtest.service-now.com/navpage.do
The https://axtest.service-now.com/navpage.do
And it's blank.
Im expecting it to show my page
https://axtest.service-now.com/nav_to.do?uri=%2Fui_page.do%3Fsys_id%3D4189bcecdb85df40f439b6bffe961996
I have tried
action.setRedirectURL() and that don't trigger at all.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 12:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 01:20 AM
Hi,
Try with below URL. You have added extra / after uri=.
https://axtest.service-now.com/nav_to.do?uri=ui_page.do%3Fsys_id%3D4189bcecdb85df40f439b6bffe961996
location.href = url;
Is alert is working?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 01:27 AM