How to export specific fields from Multiple Child Incidents into a single Excel file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi everyone,
I’m working on a requirement where I need to generate an Excel file containing data from multiple Child Incidents associated with a parent record.
Specifically, I need the export to include the following fields from the child records:
Incident Number
Short Description
Subject Person (or 'Requested For' name)
My Goal:
I want to be able to trigger this export (either via a UI Action or a scheduled process) and ensure it captures the related child incident data accurately, even if the fields are on the User table (like the name of the Subject Person).
Questions:
What is the most efficient way to achieve this? (e.g., Export Sets, Data Broker, or a custom Script Include?)
How can I ensure I am pulling the "Name" string of the Subject Person rather than just the SysID in the Excel output?
If using a UI Action, is there a way to prompt the download immediately for the user?
Any scripts, Flow Designer suggestions, or architectural advice would be greatly appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hello @suraj sengar ,
Use this script in UI Action to get the pdf downloaded with the required fields you want :
var v = new sn_pdfgeneratorutils.PDFGenerationAPI();
var html;
var gr = new GlideRecord('incident');
if (gr.get(current.sys_id)) {
html = 'Short Description : ';
html = html + gr.short_description.toString();
//ADD FIELDS WANT TO SHOW ON PDF..
}
var result = v.convertToPDF(html, 'incident', current.sys_id, 'Incident PDF');
if (result.status === 'success' && result.attachment_id) {
var downloadURL = '/sys_attachment.do?sys_id=' + result.attachment_id;
var gURL = new GlideURL(downloadURL);
action.setRedirectURL(gURL);
} else {
gs.addErrorMessage('PDF generation failed or no attachment ID returned.');
}
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
you can't create EXCEL file within ServiceNow as there is no OOTB API/Class for this.
You can create a PDF or CSV file for this
Generating Custom PDFs - using the new PDFGenerationAPI
another method
Generate PDF and attach to the record
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader

