- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2016 03:20 AM
I want to run a report when i click a ui action called test:
I wrote this on the onclick field of ui action:
action.setRedirectURL('https://dev10361.service-now.com/sys_report_display.do?sysparm_report_id=22ef12f30f26620007753b8ce10...
This is the URL of the published report that i want to run on click of 'test' ui action.
This isn't working.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2016 03:57 AM
Hi,
Try this
function runReport(){
url = '<url of your report>'
var newWin = window.open(url);
newWin.document.getElementById('run-report').click();
}
to get the url of the report I opened the report i wanted and then opened the developer console. In the console type this.location.href and right click the link and copy the link address.
Here is the UI action. Works for me.
best,
Tone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2016 03:57 AM
Hi,
Try this
function runReport(){
url = '<url of your report>'
var newWin = window.open(url);
newWin.document.getElementById('run-report').click();
}
to get the url of the report I opened the report i wanted and then opened the developer console. In the console type this.location.href and right click the link and copy the link address.
Here is the UI action. Works for me.
best,
Tone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2016 06:04 AM
Hi,
This worked but i dont want the report to be opened in a new tab. i want it to get opened in same tab.
Also, i am adding following code in the same function to run a scheduled report but it is not getting triggered:
function runReport(){
var newWin = window.open(url);
newWin.document.getElementById('run-report').click();
var gr = new GlideRecord('sysauto_report');
if (gr.get('3effde770f26620007753b8ce1050eb3')) {
SncTriggerSynchronizer.executeNow(gr);
gs.log("done");
}
}
If i try separately only that piece of code(the one to trigger the scheduled report), it does work, but when i try as above, only report is running but not scheduled report.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2016 04:05 AM
Hi
onclick:
onGoToReportPortal()
Script:
function onGoToReportPortal() {
window.location = url;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2016 06:05 AM
How to prevent it from opening in new tab ?