generate a pdf of selected fields in a form using ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 12:12 AM
this script showing only field
Does anyone know how to modify the previous code to only include certain multiple fields?
Or alternatively how to create a pdf with only certain values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 12:42 AM
Hi @marrikruthi Try this code
var inc = current.number;
var fieldsToInclude = ['short_description', 'description', 'priority'];
var pdfGenerator = new sn_pdfgeneratorutils.PDFGenerationAPI();
var data = {};
fieldsToInclude.forEach(function(field) {
data[field] = current[field];
});
var pdfResult = pdfGenerator.convertToPDFWithHeaderFooter(
inc,
'incident',
current.sys_id,
current.number + ' Number PDF',
data // Pass the data object here
);
if (pdfResult) {
action.setRedirectURL('https://dev225695.service-now.com/sys_attachment.do?sys_id=' + pdfResult.attachment_id);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 01:59 AM
@Sid_Takali
i have changed the above script with my requirements , but is not working can you please check the script that i have edited
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:05 AM
Hello @marrikruthi ,
Here are the links to some helpful resources -
- PDFGenerationAPI
- Generating Custom PDFs - using the new PDFGenerationAPI
- KB0996100
- Building a PDF report using PDFGenerationAPI
Hope it helps.
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:29 AM
@Sid_Takali @ShubhamGarg
Above information is not related to my requirement