Scripting in HR document templates

Justin Lucas
Kilo Sage

We have a requirement for populating a dynamic table in an HR document template so that it can be generated in PDF, printed, and signed by an employee. From the HR document template, we can reference fields on the case but we are not able to pull in a related list of data. For instance, we have a custom table that contains a one-to-many relationship between the case and related table, meaning an HR case can have many related records on this custom table. We are needing to populate a table in the HR document template using the records that are related to the case.

The only way I can think to make this happen is with scripting. Is it possible to call a script from an HR document template so that we can build the table in the script and print it on the template (similar to an email script in a notification)?

1 ACCEPTED SOLUTION

This is a great idea to be entered as a record in the Ideas section of the Community. This is a great way to facilitate others to vote on the idea and see results.

View solution in original post

6 REPLIES 6

Tanaji Patil
Tera Guru

Have you checked this?
https://community.servicenow.com/community?id=community_question&sys_id=3b8ca9b9db3d9700852c7a9e0f96...

-Tanaji
Please mark response correct/helpful if applicable.

Christian Prob2
Tera Guru

Great Suggestion!!!  A little nudge towards @michaelj.sheridan ðŸ˜‰

I was actually surprised that no scripting is supported - like for email templates. Advanced field mapping as suggested by @Tanaji Patil helps but required using PDF document to start with. Since the formatting and filling fields with different length content can be very painful it would be great if somehow the mail-script concept could be made available for the HTML based templates!

This is a great idea to be entered as a record in the Ideas section of the Community. This is a great way to facilitate others to vote on the idea and see results.

Good Point! @Justin Lucas - Do you want to enter it? I'll upvote!