Document Template Advanced Scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2023 08:12 AM
Hello, I have a Form That needs to be filled out by multiple users. My goal also with the form is to make sure that the data that we already have is prepopulated on the form. So far I have all of the data being prepopulated. I am running into the issue of checking the box on the form. I am using scripting to set the scripting to checked. It seems that the box gets checked because when I download the form while user opens it to fill out it shows that the box is checked but the ServiceNow UI is not showing that. Please assist if you have any Ideas.
I have posted picture of my script that checks the box and the box being checked after download.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2023 06:52 AM
Hello @Sandeep Rajput , When I replace 'Yes' with 'true' nothing happens. It does not even accept it when I open it in adobe PDF editor also. 'Yes' is the value it is looking for at least for the PDF application. I don't know what the value will be for ServiceNow.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2023 07:17 AM
@mlamin Could you please check this thread and apply the solution suggested by the original poster https://www.servicenow.com/community/hrsd-forum/pdf-document-templates-mapping-a-checkbox-field/m-p/...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2023 08:38 AM
@Sandeep Rajput Thank you for the guidance. relating to my issue since the PDF is already generated and I am just mapping the fields, How can I set these variables he mentioned. like the attachmentsysId to use the getFieldType() function.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2023 09:05 AM
@mlamin The intent of using getFieldType() method in your code is to see the list of variables your Fillable PDF have and to check what type of input each variable expects.
You can also run this script as part of a background script and log this data in the system log using gs.info.
Based on the details observed in the logs, you can modify your field mapping script for checkbox.