Download the Audit Report in Word format

Abdul Rashid
Tera Contributor

Hi, I have a requirement to download the Audit report on Engagement record in Word format and PDF format. When the Audit Engagement record moved from awaiting approval to followup state, we get a 'Generate Report' button. On click of Generate report button, I want to add two buttons to download the report in word and pdf format. 

Thanks in advance.

3 REPLIES 3

Community Alums
Not applicable

Hi @Abdul Rashid ,

In OOTB, whe you click on "Generate Report" UI action in enaggement record while the record is in Awaiting approvalFollow up, or Closed complete state, the report will be published in the Knowledge base selected in the Report section of the Engagement form:

Report section of the Engagement form
Field Description
Report template Template used to generate the knowledge base article that reports the engagement results.
Report knowledge base Knowledge base to be used.

 

In your case, as per your requirement It will be a custom solution,You can use the below code in your UI action to generate a PDF :

function generatePDF(){
var sysparm_table = g_form.getTableName();
var sysparm_sys_id = g_form.getUniqueValue().toString();
var link='https://dev113064.service-now.com/'; // Replace with  sys_parm to get the instace name 
var url = link+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
g_navigation.openPopup(url);
}

 

 

Hi @Community Alums ,

Thanks for your solution. The published article is stored in Report field of the Engagement record. When I click on 'Generate Report PDF' button I have to download the published kb article stored in Report field. I have tried with the script you have provided and on my way, but unable to download. 

 

 

AbdulRashid_0-1708410166645.png

 

Community Alums
Not applicable

Exporting to a word file would be much more consumable than the XML/excel based export today that prints the raw content, that's why ServiceNow doesn't have this feature till now. You can export KB articles in PDF/XML/Excel/CSV.

Knowledge Articles - Export to Word functionality - Support and Troubleshooting (servicenow.com)

There is also an integration with Office 365, check article https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1128793.