
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2020 07:40 AM
Hi Experts,
I am working on a functionality to direct to a custom made service portal when a button (UI Action) is clicked. Below are the things I have tried:
1. action.setRedirectUrl("/nav_to.do?uri=/cc3");
2. action.setRedirectUrl("/nav_to.do?uri=%2Fcc3");
3. action.setRedirectUrl("/nav_to.do?uri%3D%2Fcc3");
All the above approaches had the client checkbox unchecked (set to false). I also have tried checking the client checkbox (set to true). Adding an appropriate function name in the "Onclick" along with changing the way of redirection from action.setRedirectUrl to window.location.href. But no luck.
I am aware that if I modify the URL from "instancename.service-now.com/nav_to.do" to "instancename.service-now.com/nav_to.do?uri=/cc3" then the appropriate PORTAL page is being redirected to withing the native servicenow content frame. But somehow, if I try to accomplish the same using UI action, that doesn't work.
Any inputs with respect to this would be highly appreciated.
Regards,
Vismit
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2020 03:01 AM
Hi Vismit,
Try this
I have use this on my incident table to view the "kb_view2" page. With client = checked and OnClick = "goToPortal()"
function goToPortal(){
var portalName = "/myportal?id=kb_view2"; //Replace with your own url. Make sure the portal doesn't contain header otherwise it will not look good
g_navigation.open(portalName);
}
Let me know if it works out for you. It was to my surprise that window.open(url, '_top') was not working
NOTE: This worked for me on instance with Orlando Release.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2020 03:01 AM
Hi Vismit,
Try this
I have use this on my incident table to view the "kb_view2" page. With client = checked and OnClick = "goToPortal()"
function goToPortal(){
var portalName = "/myportal?id=kb_view2"; //Replace with your own url. Make sure the portal doesn't contain header otherwise it will not look good
g_navigation.open(portalName);
}
Let me know if it works out for you. It was to my surprise that window.open(url, '_top') was not working
NOTE: This worked for me on instance with Orlando Release.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2020 03:20 AM
Hi Rupam,
Thanks for that input. Some modifications to your code got it working for me.
Changes:
g_navigation.open was somehow still giving me the page as blank. But, g_navigation.reloadWindow() and then g_navigation.open() did the trick for me!
Regards,
Vismit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2020 03:26 AM
Great. Nice... Post the code
So that it would be helpful for everyone.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2020 03:34 AM
function goToPortal(){
var portalName = '/ext?id=proposed_change_v3&table=' + g_form.getTableName() + '&sys_id=' + g_form.getUniqueValue() + '&view=portal&edit_from=ci';
g_navigation.reloadWindow();
g_navigation.open(portalName);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2020 03:39 AM
This is the code that worked for me:
function goToPortal(){
var portalName = '/ext?id=proposed_change_v3&table=' + g_form.getTableName() + '&sys_id=' + g_form.getUniqueValue() + '&view=portal&edit_from=ci';
g_navigation.reloadWindow();
g_navigation.open(portalName);
}