- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2015 02:20 AM
Hello Everyone,
I am trying to redirect a URL by using action.serRedirectURL(url);
But when I use this function in UI action it redirects me to the specified URL but into a new window / Tab and not in the same window.
I want, it to open in same window / tab.
Please let me know your suggestions on same.
Thank You
Vineet
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2015 12:34 AM
Hello Everyone,
Got the reason why I was getting redirected to new tab / window.
Earlier I was using the below url for redirecting:
var url = "https://<instance-name>/$m.do#/form/sc_req_item/"+current.sys_id+"/sysparm_view=Mobile";
action.setRedirectURL(url);
But instead, have to use the URL in the following form and which helped me to redirect on the same tab / window.
var url = "#/form/sc_req_item/"+current.sys_id+"/sysparm_view=Mobile";
action.setRedirectURL(url);
i.e. just the url from "#/form" excluding the <instance-name> part.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 02:01 PM
Hi Vineet,
Have you tried using window.location.href ?
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 08:28 PM
Hi Berny,
Yes, I have tried "window.location.href", but it seems "window" function doesnt work in case of mobile UI Actions.
Thank You
Regards
Vineet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 09:40 PM
Ah ok. I guess your UI action is a server one.
Have you tried doing a redirect using the glideRecord of the record you will like to redirect to?
To direct a user to a record, use this syntax, where new_record is the variable name for the GlideRecord:
action.setRedirectURL(new_record);
Source: http://wiki.servicenow.com/index.php?title=UI_Actions#Using_a_UI_Action_to_Redirect_to_a_URL
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2015 09:44 PM
If that doesn't work, then you may want to try switching your UI action to be a client one
I hope this helps.
Thanks,
Berny