Generate a report via script?

tim_schneider
Tera Contributor

Hi,

I've looked through documentation and done some searching but I'm a bit stumped. Does anyone know if it's possible to generate a standard ServiceNow report (Such as a pie chart) to a file (e.g. png, jpg, pdf) via script?

I'm looking to attach the result into an existing process, but it is desirable for the report to generate itself rather than forcing the user to go, view the report, export it, then attach it back into the process... but I'm having no luck finding a mechanism to do this without user-interaction.

Thanks.

14 REPLIES 14

Madankumar N1
Tera Contributor

Am also have same requirement. Did you found the solution for this requirement

No I haven't been able to crack this one yet... I'm not convinced ServiceNow actually offers access to do this... they have the platform capability clearly cause they can do it for emails but they haven't exposed it for regular users.

We're at serious risk of having to export the data out and do our reporting outside the platform if we can't solve this problem.

Thanks for Quick reply.

my report is on knowledge base only i need to attach that report to my incident. when am creating incident that report has to run and attach to the incident.

Do you have any idea about this one to resolve the issue.

That's pretty much the exact use-case I'm after also. I'll be doing a bit more with the report after generating it, but that's the missing link - if I could generate to attachment I'd be done myself.

If you find a way let me know. I'll also make sure to put it here if I find a solution.

Sandeep Kumar6
Giga Guru

HI Tim,

Please follow the below procedure you will get your answer.

 Generate data for a custom report.

  1. Navigate to Reports > Custom Charts.
  2. Select an existing chart or create a new one.
  3. In the Custom Chart form, click New in the Uses Generator related list.

    The Scheduled Report Summary Generation form appears

     

    https://docs.servicenow.com/bundle/geneva-performance-analytics-and-reporting/page/use/advanced_reporting/task/t_DataGeneration.html

     

    OR

    you need not to create script for this and if the filter is dynamic than you can create a dynamic filter by using script include. This script include will return the sys_ids of the records coming after encoded query condition and can set filter as sys_id in javascript:scriptinclue().function().

    https://docs.servicenow.com/bundle/geneva-performance-analytics-and-reporting/page/use/advanced_reporting/concept/c_GenerationScript.html

    https://community.servicenow.com/community?id=community_question&sys_id=335b0b21db9cdbc01dcaf3231f9619e3

     

     

     

    Mark Helpful/Correct if you get your answer

    Regards

    Sandeep