PDF Field Mapping Advanced Scripting

melina1
Giga Contributor

Hello, 

How can we use the advanced scripting within the PDF Template Field Mapping? 

For example, I have a field on a form called Account Number that I need to map to a field in a custom table. 

The custom table name is Federal Onboarding Questionnaire & the field we'd be taking from would be account_number. 

Thank you!!

 

 

 

 

3 REPLIES 3

Tom O_Neill
ServiceNow Employee
ServiceNow Employee

You will need to be able to either dotwalk to the custom table (Federal Onboarding Questionaire) from the HR Case or otherwise query to find the appropriate record in that table based upon the information in the HR Case.

 

In the attached screenshots, I have the HR PDF Template associated with HR Case. The Address field is using an advanced script which takes the GlideRecord for the HR Case and dotwalks to HR Profile. If I wasn't able to dotwalk from the case to HR Profile I would have needed to query using something on the case (e.g., subject person).

melina1
Giga Contributor

Thank you - that was helpful. I was able to use that to dotwalk from the case table. Now I am trying to use a script include to pull from another table. Below is what I have, though it is not working. Any suggestions? 

 

 

Thank you!

Tom O_Neill
ServiceNow Employee
ServiceNow Employee

Looking at your screenshots, I'd suggest adding the prefix "sn_hr_le." to your call of the script include. If that doesn't work, then I'd try creating a new script include (no need to be client callable) with the default structure, and then call it like new sn_hr_le.TomExample().doMapping();

I'm attaching screenshots of my setup, my script include, and my generated PDF. Also attached is my input PDF that I used to create the managed document followed by the HR PDF document, which I then parsed and added the advanced script to.

 

Tom