run a report from ui action

dhirajwakodikar
Kilo Expert

I want to run a report when i click a ui action called test:

find_real_file.png

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.

1 ACCEPTED SOLUTION

tonemking
Giga Expert

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.



Screen Shot 2016-10-26 at 6.55.49 AM.png



Here is the UI action. Works for me.



Screen Shot 2016-10-26 at 6.56.42 AM.png



best,



Tone


View solution in original post

8 REPLIES 8

Hi,



do location.href = url to prevent it from opening in a new tab.



function runReport(){


var url = '';


location.href = url;


}



Tone


That works.


Thanks for the help


window.open(url, "_self");



use the above line to open in same page


this didn't work.