Modifying UI Action Redirect to "target=_blank"

markmmiller09
Kilo Expert

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?

4 REPLIES 4

Mark Stanger
Giga Sage

You could try a 'Client' UI action with the following code included in the function you call...



window.open('http://yoururl.com','_blank');


So if my UI Action is currently server side, I would need it to call a client script where I store the above JavaScript?


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/


arnaud_monnier
Kilo Explorer

You will find your solution here



Posting to External URL via UI Action