when we export a pdf from a custom workspace and a custom table I have few issues
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 11:32 PM
when we export a pdf from a custom workspace and a custom table I have few issues
1.my pdf is getting downloaded with the table name
2.I am able to see my table name on the pdf
3.and in the workspace I have few html fields in that if I give bold text the text is coming as normal text in the pdf
can we change these three ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 11:35 PM - edited 05-23-2024 11:38 PM
How are you exporting this, by using OOTB export action or have you created your own custom action for it?
You can achieve it through custom solution:
Ref: https://www.servicenow.com/community/developer-articles/generating-custom-pdfs-using-the-new-pdfgene...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 11:44 PM
@Abhit by using OOTB export action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 11:57 PM
In OOTB file name will come as table name followed by sys_id which is expected behavior.
I would suggest you to create a custom ui action and try the bellow code: or your can ref the link as well.
Update the field mapping.
var pageProperties = {
HeaderImageAttachmentId: 'attachment_sys_id',
HeaderImageAlignment: 'LEFT',
PageSize: 'A4',
GeneratePageNumber: 'true',
TopOrBottomMargin: '72',
LeftOrRightMargin: '36'
};
var html = '<p><span style="font-size: 12pt;">Complaint Details</span></p><table style="border-collapse: collapse; width: 34.169%; height: 125px;" border="1"><tbody><tr style="height: 15.3906px;"><td style="width: 39.782%; height: 15.3906px;"><span style="font-size: 10pt;">Report Title</span></td><td style="width: 60.218%; height: 15.3906px;"><span style="font-size: 10pt;">'+current.report_title+'</span></td></tr><tr style="height: 15.3906px;"><td style="width: 39.782%; height: 15.3906px;"><span style="font-size: 10pt;">Run Date and Time</span></td><td style="width: 60.218%; height: 15.3906px;">'+current.getDisplayValue("run_date")+'</td></tr><tr style="height: 15.3906px;"><td style="width: 39.782%; height: 15.3906px;"><span style="font-size: 10pt;">Run By</span></td><td style="width: 60.218%; height: 15.3906px;">'+current.getDiplayValue("run_by")+'</td></tr><tr style="height: 15.3906px;"><td style="width: 39.782%; height: 15.3906px;"><span style="font-size: 10pt;">Table name</span></td><td style="width: 60.218%; height: 15.3906px;">'+current.table.name+'</td></tr></tbody></table>';
new sn_pdfgeneratorutils.PDFGenerationAPI().convertToPDFWithHeaderFooter(html, current, current.sys_id, 'My First PDF', pageProperties, 'font_family_sys_id');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 11:55 PM
If I create the custom solution can I add the the pdf functionality in a UI button in workspace