- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I have a Record Producer in ServiceNow that captures data such as Employee Name, Employee ID, Joining Date, Department, and Salary.
The requirement is:
When the record producer is submitted, a record must be created in a custom table (say u_employee_details).
Immediately after record creation, a PDF should be generated using the same data.
The generated PDF should contain selected fields (like Employee Name, Employee ID, Salary, Joining Date) and should be attached to the created record automatically.
How will I implement this end-to-end solution in ServiceNow?
Till point 1 I am okay to create RP but how create a PDF ??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
You can use the Flow Designer as soon as the record gets created in the table.
After that, you’ll need to use the PDF Generation API. I don’t have much experience with it, but I’m sharing a few useful links below.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @SandeepKSingh ,
For step 2 you could trigger an insert BR on the custom table and use the PDF API from servicenow: PDFGenerationAPI - Scoped, Global | ServiceNow Developers
But it requires some knowledge how to script these files. But it's doable.
There are some good examples on the provided page.
Good luck,
Collin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @SandeepKSingh
Create a Record Producer pointing to the custom table 'u_employee_details'.
Add variables as per your choice
Map the variables to fields in the table via producer script or variable mapping.
Example Script :-
var rec = new GlideRecord('u_employee_details');
rec.initialize();
rec.u_employee_name = producer.u_employee_name;
var newSysId = rec.insert();
Create a Business Rule on u_employee_details
table:
When: after insert
Action: Call a Script Include that generates a PDF.
....
Script Include Code I will be updating Soon.. after testing ..
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @SandeepKSingh ,
----------------------
Please try this Script Include its working on My side
------ I have use the POST which other members have posted !!-----------
var PDFGeneratorUtils = Class.create();
PDFGeneratorUtils.prototype = {
initialize: function() {},
generateEmployeePDF: function(sysId) {
var gr = new GlideRecord('u_employee_details');
if (gr.get(sysId)) {
// Prepare HTML for PDF
var html = "<h2>Employee Record</h2>" +
"<p><b>Name:</b> " + gr.u_employee_name + "</p>" +
"<p><b>ID:</b> " + gr.u_employee_id + "</p>" +
"<p><b>Joining Date:</b> " + gr.u_joining_date + "</p>" +
"<p><b>Salary:</b> " + gr.u_salary + "</p>";
// Generate PDF (requires Document Generation / PDF plugin)
var pdf = new sn_pdfgeneratorutils.PDFGenerationAPI();
var pdfDoc = pdf.convertHTMLToPDF(html);
// Attach PDF to record
GlideSysAttachment.insert(sysId, 'u_employee_details',
"Employee_Details.pdf", "application/pdf",
pdfDoc);
}
},
type: 'PDFGeneratorUtils'
};
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
You can use the Flow Designer as soon as the record gets created in the table.
After that, you’ll need to use the PDF Generation API. I don’t have much experience with it, but I’m sharing a few useful links below.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
these links have solution, check that and enhance
ARTICLE: Create PDF for Record Producer using PDFGenerationAPI
When catalog item is submitted, attach variables to RITM as a PDF
Generate PDF file for catalog variables and attach it to RITM
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
yesterday
Hi @SandeepKSingh ,
For step 2 you could trigger an insert BR on the custom table and use the PDF API from servicenow: PDFGenerationAPI - Scoped, Global | ServiceNow Developers
But it requires some knowledge how to script these files. But it's doable.
There are some good examples on the provided page.
Good luck,
Collin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @SandeepKSingh
Create a Record Producer pointing to the custom table 'u_employee_details'.
Add variables as per your choice
Map the variables to fields in the table via producer script or variable mapping.
Example Script :-
var rec = new GlideRecord('u_employee_details');
rec.initialize();
rec.u_employee_name = producer.u_employee_name;
var newSysId = rec.insert();
Create a Business Rule on u_employee_details
table:
When: after insert
Action: Call a Script Include that generates a PDF.
....
Script Include Code I will be updating Soon.. after testing ..
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/