Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

PDF Generation with data from parent and child record (Document Template)

david08
Tera Contributor

Hello everyone,

I have the following use case:
I want to generate a PDF from a record and attach the PDF to the record. 

The PDF should contain data from the parent record and the child record.

 

I created an UI Action with a form button and used sn_doc.GenerateDocumentAPI() to create the PDF and attach it to the record. Works well.

I am using Document Template to create the PDF template: https://store.servicenow.com/store/app/aee82b2e1be06a50a85b16db234bcb06


In the document template editor I can add fields from the parent record but not from the child records.
Does anyone know a way how to access child records?

 

Thank you for your support!

 

 

2 REPLIES 2

Aditya_hublikar
Mega Sage

Hello @david08 ,

 

I didn't use this before, I dont have detail  idea about document template But if there is option for server side script ,  then  you can fetch data from your relevant child table using GlideRecord.

 

If my response helps you then mark it as helpful and accept as solution.

Regards,

Aditya

SohamTipnis
Mega Sage

Hi @david08,

 

You can refer to the below documentation; I used this when I had this requirement. Hope this helps you:

 

https://www.servicenow.com/docs/r/zurich/servicenow-platform/document-management-services/pdf-genera...

 

https://www.servicenow.com/docs/r/zurich/servicenow-platform/document-management-services/guardrails...

 

If you find my answer useful, please mark it as Helpful and Correct. ‌‌‌‌‌‌‌😊


Regards,
Soham Tipnis
ServiceNow Developer ||  Technical Consultant
LinkedIn: www.linkedin.com/in/sohamtipnis10