
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2018 04:00 AM
Hi,
I need to have a button on incident.
When the button is clicked, a PDF must be generated. That PDF must contain details of assigned_to user and some custom text which client has suggested.
Help me in understanding as to how can I achieve this.
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2018 03:36 AM
Hi,
Use this share utility:
https://developer.servicenow.com/app.do#!/share/contents/3429377_pdf_generator?v=1.02&t=PRODUCT_DETAILS
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018 08:52 AM
1. Well the library is on the client side so you can import it just as any third party library, from CDN maybe or you can even host it on the platform.
2. yeah so the library I use (pdfmake) you basically build the pdf yourself, so I just pass the data in a UI page query the database with gliderecord and pass it to the client side just in a javascript variable, then the client side generates the pdf. it's not sending a html page into it but rather directly data style information is also in the variable.
3. as for how to open a new window or call your UI page, I think you can set just a browser redirect in your UI action to point to your UI page.
But I did invoke a glidedialogwindow which calls my UI page and opens it in a dialog window.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2018 09:00 AM
I guess an example would be,
server side:
<jelly script tag>
gr = new GlideRecord("incident");
var parcel =[];
while (gr.next()){
parcel.append(gr.getstuff());
}
parcel.append(addsomeotherstuff());
parcel.stringify();
<jelly script tag/>
client side:
<script src="somecdn.com/pdfmake" />
<script>
var content = JSON.parse (${parcel}).customParseFunction()
pdfmake.createPDF(content).open()
</script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2020 04:06 AM
Hey,
We have developed a solution that allows you to generate DOCX, PPTX and XLSX files directly from ServiceNow, based on user templates. You can choose what data you want to export so you don't get a file cramped with data.
After exporting you can always edit your files and save them as PDF if needed.
If you are curious about it, we have an article with some more information:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 07:20 AM
I cannot access this Link