PDFsuite Custom Forms Mappings

Set Radio Groups

A radio group is a special type of field mapping that can map a single ServiceNow field or catalog variable to multiple checkboxes on a PDF form and treat them as a radio group. In effect, only one of the checkboxes will be checked at a time and the value set to the ServiceNow field/variable will depend on which box is checked.

setRadioGroups

helper.setRadioGroups(record, groups)

Where record is the GlideRecord fields/variables are mapped from and groups is an array of IRadioGroup Objects

IRadioGroup

name

A unique name for the radio group.

Type: string

serviceNowField (optional)

The name of the ServiceNow field to map to/from. This can be omitted when using the value property to map a static value to a PDF Field or When mapping a catalog variable.

Type: string

catalogVariable (optional)

The name of the ServiceNow catalog variable to map to/from. This can be omitted when using the value property to map a static value to a PDF Field or When mapping a ServiceNow field.

Type: string

variableType (optional)

Type: string

Option Description
'checkbox' A checkbox variable.
'yes-no' A yes/no variable.
'single_line_text' A single line text variable.
'multi_line_text' A multiline text variable.
'date' A date variable.
'date-time' A date time variable.
'reference' A reference variable.
'numerical_scale' A numerical scale variable. The ICustomFieldOptions min and max properties can be set to limit the input values. ie. {min: 0, max: 5}
'multiple_choice' A multiple choice variable. The choices property can be used to configure choices.
'select-box' A select box variable. The choices property can be used to configure choices.

readonly (optional)

Makes the mapped PDF field always readonly regardless of the ACLs from the mapped record and form workflow edit permissions.

Type: true/false

Default Value: false

fields

Provides the PDF form fields used for the group.

Type: ICustomField array

defaultValue

The value to set the ServiceNow field/variable to if none the boxes are checked.

Type: string, number, true/false, or null

ignoreACL (optional)

Allows PDFsuite to read and write to fields when ACLs disallow it. This is often paired with the readonly property so a field can be written programmatically.

Type: object

Property Type Description
read true/false If true always allows read of data, if false honors ACL
write true/false If true always allows write of data, if false honors ACL

Example

In the following example two PDF form checkboxes, Approval and Disapproval, are configured to be a radio group mapped to a ServiceNow field called approval. When Approval is checked the approval field is set to 'approved'. When Disapproval is checked the approval field is set to 'rejected'. when Neither is checked the approval field is set to the default value 'not requested'. The mapping is bidirectional so based on the value of the approval field the appropriate checkbox will be checked.

helper.setRadioGroups(current, [
  {
    name: 'approval',
    serviceNowField: 'approval',
    fields: [
      {name: 'Approval',  type: 'checkbox', value: 'approved'},
      {name: 'Disapproval', type: "checkbox", value: 'rejected'},
    ],
    defaultValue: 'not requested'
  }
]);