Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

PDF Document Templates - Mapping a checkbox field

alijubran
Kilo Expert

Hi folks,

Has anyone else explored the PDF Document Templates in depth? I have parsed the Federal I9 PDF form and there are several checkbox field types on the pdf. For whatever reason, I cannot mark these checkbox fields. I have tried mapping a true/false field from the HR Profile. I have tried just pushing 'true' through the script field in the mapping record. Also tried using 1 as an integer incase the PDF treated it this way.

Have you had any success populating a checkbox field? And to that point what about the other PDF field types that are not text?

Any help is greatly appreciated!

Thanks,

Ali Jubran

3 REPLIES 3

alijubran
Kilo Expert

I found the answer to this. It seems that there is no standardized value that is used to pass through to a checkbox. You will need to extract the acceptable value from the document. To do so I used the GeneralPdfUtils() and the getFieldType() method will return all the fields, their types, and accepted values.

So for my specific document the I9, a check box is marked by passing "1". Other documents may be true/false, YES/NO, On/Off.

 

Hi Alijubran,

 

I am having the same issue. The question is Are you a US Citizen? Yes? No? The yes and no are checkboxes. I went to the document template and noticed there are 3 fields that will need to be mapped. Field 1: Are you a US Citizen? Field 2: Yes Field 3: No

 

I used scripts for the yes and no fields and I used the following script:

 

(function evaluateMappingFieldValue(caseGr /* GlideRecord for parent case */, mappingField /* Pre-computed mapping field value */) {
if (caseGr.u_us_citizen=='yes')
return '3b';
return 'Off';

})(caseGr, mappingField);

 

However its not working. 

 

 

Hey paradise624,

 

JavaScript will exit the function after the first return '3b'; so the Off will be ignored.

 

if (caseGr.u_us_citizen== true){
    var <variable> = "Yes";
  }
  else{
    var <variable> = "Off";
  }
 
This worked for me. The Check box in the PDF I am using uses Yes for true and Off for false. I retrieved the value from ServiceNow and used an if/else to assign the proper value. 
 
Also servicenow's checkboxes return value of true or false. Not "Yes".
 
Hope this helps