- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2023 09:45 AM
HI Team,
I am trying to redirect to a URL using UI Action for eg. action.RedirectURL('xyz.com');
Its giving message on center of page as "refused to connect." But when I open the URL from browser I am able to see the login page.
Can you assist, how to get rid of this error?
BR,
Ankur
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2023 01:39 AM
Its not working.I am getting below error in the logs:
com.glide.script.RhinoEcmaError: "window" is not defined.
sys_ui_action.408457c0db55e910ec203ec8f4961905.script : Line(17) column(0)
14:
15: var url = 'https://' + gs.getProperty('it.glue.com') + '/' + current.u_global_id;
16: gs.info(url);
==> 17: window.open(url, '_blank');
This is server side code, does "window" command work in server side?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2023 10:30 AM
The "refused to connect" error message typically means that the server hosting the URL you are trying to redirect to is not responding to requests. Here are a few things you can try to resolve the issue:
Verify that the URL you are trying to redirect to is correct and accessible. Try opening the URL from a different browser or device to see if it loads.
Check if there are any firewall or network restrictions that are preventing the ServiceNow instance from connecting to the URL. Contact your network administrator or IT team to confirm if there are any restrictions or firewalls in place that could be causing the issue.
Ensure that the URL is using the appropriate protocol. For example, if the URL is using HTTPS, make sure that your ServiceNow instance is configured to allow HTTPS connections.
Try using a different method to redirect to the URL. For example, you can use JavaScript to open a new window or tab and navigate to the URL.
Here's an example of how you can use JavaScript to redirect to a URL:
action.setRedirectURL('javascript:window.open("https://xyz.com","_blank");');
This will open the URL in a new window or tab, bypassing any potential network or firewall issues that may be causing the "refused to connect" error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2023 05:53 AM
@Syedmd08 I need to open the in new window in server side code in UI Action.
function runbook() {
var globalid = g_form.getValue('u_global_id');
if (!globalid) {
g_form.addErrorMessage('Service is unreachable' + ',' + 'Link to Runbook is not available');
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'run_book');
}
if (current.u_global_id != '') {
action.setRedirectURL('https://'+gs.getProperty('it.glue.com')+'/'+current.u_global_id);// if I do gs.info() and log this, it gives correct URL but its not redirecting to that page.However if I open directly in a browser, it opens up the login page of that website.
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2023 08:42 AM
It looks like the issue might be related to the way you are trying to redirect to the URL using the action.setRedirectURL method.
Instead, you can try opening the URL in a new window using the window.open() method in JavaScript. Here's an example of how you can modify your code to do this:
function runbook() {
var globalid = g_form.getValue('u_global_id');
if (!globalid) {
g_form.addErrorMessage('Service is unreachable' + ',' + 'Link to Runbook is not available');
return false;
}
var url = 'https://' + gs.getProperty('it.glue.com') + '/' + current.u_global_id;
window.open(url, '_blank');
}
This code will open the URL in a new browser window when the runbook() function is called. Make sure to save and test your UI Action after making these changes.
Please mark my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2023 01:39 AM
Its not working.I am getting below error in the logs:
com.glide.script.RhinoEcmaError: "window" is not defined.
sys_ui_action.408457c0db55e910ec203ec8f4961905.script : Line(17) column(0)
14:
15: var url = 'https://' + gs.getProperty('it.glue.com') + '/' + current.u_global_id;
16: gs.info(url);
==> 17: window.open(url, '_blank');
This is server side code, does "window" command work in server side?