How to Open a URL from Background Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2017 03:37 AM
Hi Everyone,
Can I open a URL from background script or script include. For example I want to open www.google.com in a new tab from background script. Is it
possible ?. I know its possible from Client script but I have a certain requirement in which I have to open the URL from backgdoun script
( script include). Thanks in advance everyone.
Thanks with regards,
Rahul Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2017 03:12 AM
Thanks Sachin for the reply.
I tried gs.setRedirect(url) in the background but it didn't worked
Thanks with regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2017 12:06 PM
Rahul, let's make one thing clear, there is a huge difference between Background Script and Script Include. They both uses Java, they are two different beasts; functionality wise. Although they both are powerful, Background Script can do some serious damage if proper precautions are not taken when authoring a script.
Please see below:
Script Includes - ServiceNow Wiki
I hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2024 06:11 PM
You can open URL inside the script of an UI action using the `action.setRedirectURL` API. The following example is taken from the script of the "Export to XML" UI action.
action.setRedirectURL("export_update_set.do?sysparm_sys_id=" + sysid + "&sysparm_delete_when_done=true&sysparm_is_remote=false&sysparm_ck=" + gs.getSessionToken());