- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2025 02:39 AM
When an end user submits a catalog through the portal, the system should automatically generates a PDF document containing all the submitted information.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2025 05:28 AM
you can use PDF Generation API
check this link which has script from Piyush
Generate PDF file for catalog variables and attach it to RITM
you can check the PDF Generation API for this
Generating Custom PDFs - using the new PDFGenerationAPI
another method
Generate PDF and attach to the record
When catalog item is submitted, attach variables to RITM as a PDF
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Thanks for the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Thanks for helping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi @AkashL722774083 ,
I hope you saw my reply.
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. It will help future readers as well having similar kind of questions and close the thread.
Thanks,
Bhimashankar H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
This code might help you
(function() {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('cat_item', '<catalog_id>'); // Replace with your Catalog Item sys_id
gr.query();
while (gr.next()) {
createPDF(gr); // pass each RITM
}
function createPDF(ritmGr) {
var html = "<h2>Catalog Request Details</h2>";
html += "<p><b>Requested For:</b> " + ritmGr.request.requested_for.getDisplayValue() + "</p>";
html += "<p><b>Catalog Item:</b> " + ritmGr.cat_item.getDisplayValue() + "</p>";
html += "<hr/>";
// Collect Variables
var catGr = new GlideRecord('sc_item_option_mtom');
catGr.addQuery('request_item', ritmGr.sys_id);
catGr.query();
while (catGr.next()) {
var optionGr = new GlideRecord('sc_item_option');
if (optionGr.get(catGr.sc_item_option.toString())) {
var label = optionGr.item_option_new.getDisplayValue(); // variable label
var value = optionGr.value; // submitted value
html += "<p><b>" + label + ":</b> " + value + "</p>";
}
}
// Generate PDF and attach to RITM
var pdfAPI = new sn_pdfgeneratorutils.PDFGenerationAPI();
var attachmentId = pdfAPI.convertToPDFWithAttachmentName(
html,
ritmGr,
"Catalog_Request_" + ritmGr.number + ".pdf"
);
gs.info("PDF generated and attached: " + attachmentId);
}
})();
The PDF will be save in the RITM generate