Mapping Variables to PDF Template Mappings

kevinthury
Tera Guru

When setting up PDF Template Mappings, is there a way to map variables from a Record Producer to the field name on an HR PDF Template?

We have a Record Producer tied to an HR Service that calls a PDF Template.  A variable on this Record Producer has a value we would like on the PDF Template.  I have tried the Advanced script to return current.variables.variable_name and caseGR.variables.variables_name.  Neither one worked.

Any ideas?

find_real_file.png

1 ACCEPTED SOLUTION

Thanks, Mike.  I was able to resolve this with a more simpler method.  My first tests were close, but resulting in '{}' populating in the PDF Template Field.

After some debugging, I found the following script to be working as intended.  Setting toString() gave me the results I wanted.  I hope there are no unintended consequences of this.

find_real_file.png

 

 

View solution in original post

3 REPLIES 3

michaelj_sherid
ServiceNow Employee
ServiceNow Employee

Hi kevinthury,

An option can be to leverage the Question and Answers table where the variables are written to. I am under the assumption that your variable is not mapped to a field.

This solution still presents some challenges to uniquely identify the variable you are trying to set in the PDF mapping, but an avenue to explore, nonetheless.

Regards,

Mike

Thanks, Mike.  I was able to resolve this with a more simpler method.  My first tests were close, but resulting in '{}' populating in the PDF Template Field.

After some debugging, I found the following script to be working as intended.  Setting toString() gave me the results I wanted.  I hope there are no unintended consequences of this.

find_real_file.png

 

 

J_Villalta CNL
Tera Contributor

My question a bit different, but related to mapping as well. My issue is that after upgrading to San Diego, there's one particular date field is displayed on the PDF form as editable field. All other fields in the PDF form, including other dates field, are displayed as read-only as we expect, since this PDF form is displayed already populated and just waiting for signature). I've reviewed that field definition, compared with these other dates fields, and nothing seems to explain why this one is editable on the PDF form. Any ideas/suggestions?

 

J_VillaltaCNL_0-1666102974453.png