Posting to External URL via UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2013 07:05 AM
Does anyone know if either of the following two are possible:
1. Redirect to an external URL for a UI Action (using a form button and the action.setRedirectURL() function). I can get it to link to an external URL, but the URL shows within the ServiceNow Iframe. I'd like to open a new tab/window to display the external URL.
2. Is it possible to execute a POST rather than a GET when redirecting to the external URL from #1?
Thanks for any input.
Brandon
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2013 12:18 PM
1:
var url = 'google.com';
//open in new window:
var win = window.open(url);
win.focus();
2:
See the following:
http://stackoverflow.com/questions/8389646/send-post-data-on-redirect-with-javascript-jquery
It looks like jQuery is the way to go here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2013 12:33 PM
1: This should do it.
if (window.location != window.parent.location) {
window.parent.location = "http://google.com";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2014 09:17 AM
Thanks all for the input.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2016 06:12 PM
Was this ever resolved? The responses so far are assuming client side scripting however the question was about creating a new tab via server side code. action.setRedirectURL() is typically used at the end of a UI action, but I cannot find any information on the "action" object to see if there are other methods that might help. We basically want to run server side code in a UI action (that generates the URL string) then spawn a new page instead of redirecting. While it is possible to have client side code in a UI action, it typically runs before the server side code, not after. It would be easier if the action object had a method other than setRedirectURL() that could be used.
Does anyone have any info on this object?