Modifying UI Action Redirect to "target=_blank"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2014 08:31 AM
I am looking to redirect a user to a specified link that opens in a new tab/window using the HTML target attribute of the <a> tag. Is there any ServiceNow function, such as setRedirectURL, that accepts an HTML target parameter? Is there a way to do this using JavaScript in a UI Action?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2014 08:33 AM
You could try a 'Client' UI action with the following code included in the function you call...
window.open('http://yoururl.com','_blank');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2014 08:57 AM
So if my UI Action is currently server side, I would need it to call a client script where I store the above JavaScript?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2014 09:35 AM
You will need to use client-side code to pop the new window open, but I've created a way that you can do both client and server code in the same UI action. Your client code would run first, pop open the window, and then the server code would run. The alternative would be a client-side UI action combined with a business rule to run the server-side piece. This should help.
http://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2014 08:57 AM