We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

PDf generation with HTML template With Loop funtionality

Kachu
Mega Sage

HI Community, I have requirement for one of the FRA report Form 55A which you can find online at https://data.transportation.gov/Railroads/Injury-Illness-Summary-Casualty-Data-Form-55a-/rash-pd2d/a...

Now. I have incident and have 5 injury records. the 55a form that is present has 3 same sections starting from  5A -5U. Each injury record is for individual who is injured not if its more than 3 it needs to append  same form again  as sheet 2 and add  record 4 and 5 information respectively. How can we  achieve this?

 We can generate one document through document template if we have editable PDF but checking the records and appending if there are more to same document and could have more than 30 injury records then shoul have 30 pages for this in one document. this is FRA reportable and need to be done.

Let me knwo if any one have any idea on how can we achieve this.
thanks

3 REPLIES 3

Florisvmuijen
Tera Contributor

Hi Kachu,

 

This is difficult to achieve using the standard ServiceNow Document Template functionality.

Document Templates can generate a document from a record, but they do not handle dynamic repeating sections very well. In your case the injury section (5A–5U) would need to repeat for each related injury record and create additional pages when needed.

 

To achieve this you would typically need either a custom solution that generates and merges multiple pages, or use a document generation application from the ServiceNow Store that supports repeating sections and multi-page output.

 

Hope this helps.

Ankur Bawiskar
Tera Patron

@Kachu 

not possible with Document template with fillable PDF since it has limitations

you can use PDF Generation API

Generating Custom PDFs - using the new PDFGenerationAPI

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

DrewW
Mega Sage

There are several ways to make this work but like others have indicated, they are all going to be custom.

 

I'm curious though, the link you supplied is to a PDF that does not appear to have any form fields.  So that means you are going to have to add them.  But then you are not pulling it from the original source so how do you plan on making sure that you have the latest version when the original changes?