Create PDF with Field Values from Task

Meloper
Kilo Sage

Hay,

i need to create a UI Action to get a PDF inlcuding Field-Values from Task.
The PDF includes a corporate Design (Picture, Header....) and has to be updated with Values from the Task.

I read something about the opportunity to export the existing PDF to HTML an edit the HTML with the Field-Values.

There are a lot oft Questios with Hyperlinks as a Solution but is there now APi or Something like that?

Example:
var PDF = new ATTACHMANET(HTML, TYP, Format, location);
var PDF = new ATTACHMANET(<p>Hello World!</p>, PDF, A4, Table.Task)

 

1 ACCEPTED SOLUTION

Meloper
Kilo Sage

Hello,
I worked with the following link and it worked!

https://community.servicenow.com/community?id=community_blog&sys_id=4acc6265dbd0dbc01dcaf3231f961949...


I had the customer create a PDF form for me. The form fields have certain designations which can be filled.

If the names of the form fields of the PDF form are unknown, they can be read out with a gs.info(fieldString);.
- first picture in the link

Otherwise, the PDF is attached to the CatalogItem (and thus to the attachment table). I activate the script to fill the PDF with a UI action (button in the header).

First a JSON object is created and then converted back to a string with JSON.Stringify.
The following compliance is important:
pdf.prefillPdf(jsonString, destinationTableSysId, attachmentSysId, destinationTableName, pdfName);

Info:
An empty PDF form is attached to the CatalogItem. I fill this form with field values from the task. The filled PDF is then displayed in the task.

Example of the prefillPdf() method:
pdf.prefillPdf(jsonString, destinationTableSysId, attachmentSysId, destinationTableName, pdfName);

 

 

View solution in original post

1 REPLY 1

Meloper
Kilo Sage

Hello,
I worked with the following link and it worked!

https://community.servicenow.com/community?id=community_blog&sys_id=4acc6265dbd0dbc01dcaf3231f961949...


I had the customer create a PDF form for me. The form fields have certain designations which can be filled.

If the names of the form fields of the PDF form are unknown, they can be read out with a gs.info(fieldString);.
- first picture in the link

Otherwise, the PDF is attached to the CatalogItem (and thus to the attachment table). I activate the script to fill the PDF with a UI action (button in the header).

First a JSON object is created and then converted back to a string with JSON.Stringify.
The following compliance is important:
pdf.prefillPdf(jsonString, destinationTableSysId, attachmentSysId, destinationTableName, pdfName);

Info:
An empty PDF form is attached to the CatalogItem. I fill this form with field values from the task. The filled PDF is then displayed in the task.

Example of the prefillPdf() method:
pdf.prefillPdf(jsonString, destinationTableSysId, attachmentSysId, destinationTableName, pdfName);