UI Action to redirect to portal within the native content frame

Vismit Ambre
Giga Guru

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

1 ACCEPTED SOLUTION

Rupam_39
Giga Guru

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. 

View solution in original post

9 REPLIES 9

Oleg
Mega Sage

Usage UI Actions in Service Portal is implemented in Service Portal with some restrictions. You can read here, for example:

All server-side UI actions are supported in Service Portal, although setRedirectURL() operations are ignored because Service Portal forms handle redirection in a different way than the platform.

The form widget ignores any UI Actions marked as Client.

In other words, it's impossible to use action.setRedirectUrl in any way or to use client side UI Actions. One can implement some workarounds only by cloning Form widget (id=widget-form) and implementing an alternative redirection way inside of $scope.triggerUIAction function, for example. The way is not simple and it's difficult to write the implementation, which works with all existing UI Actions.

 

Hi Oleg,

Hope you are doing good. There seems to be some confusion regarding the question, maybe I have not put it in an appropriate way. 

My requirement is to redirect from PLATFORM SIDE to SERVICE PORTAL, but within the PLATFORM (content frame).

 

Any help regarding the same would be highly appreciated.

 

Regards,

Vismit

Hi Vismit,

simple redirection is easy. Try for example the URL /$sp.do?id=user_profile. It will open User Profile page of the default (typically /sp) portal. Is the URL what you searching for?

Jack
Tera Guru

You can try with this (note: URL is uppercase):

action.setRedirectURL('nav_to.do?uri=sp');