PDFsuite Custom Forms Mappings

Set Field Mappings

setFieldMappings(record, mappings, name)

record

A record to map fields to/from.

mappings

An array of ICustomField objects as defined bellow.

name (optional)

A name to identify the record. Default: 'current'

A simple way to insure each record has a unique name is to use the sys_id.

ICustomField

name

The name of the PDF form field to map to.

Type: string

type (optional);

The mapping type. Effects how the data is mapped and edited on the form.

Type: string

Option Description
'string' The value will ve treated as a string on the PDF Form. This option should be used for string, number, and choice fields. This value will be used by default if none is provided.
'checkbox' The field on the PDF form is a checkbox.
'date' The value will be entered using the date editor.
'date-time' The value will be entered using the date/time editor.
'time' The value will be entered using the time editor.
'reference' The value is a lookup for a record in ServiceNow

Default Value: '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.

Default Value: 'string'

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

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

Default Values:

{
  read: false,
  write: false
}

If either read or write is omitted, it will default to false. If ignoreACL is omitted completely both read and write will default to false.

script (optional)

The name on a set of scripts used to map the data to and from ServiceNow. See addScripts for usage.

Type: string

dependent (optional)

The name of a field or a list of fields that the mapping depends on. If one of the dependant fields is changed this field will be refreshed. This is important for dot walked fields and dependant choices.

Type: string or an array of strings

value (optional)

Can be used to assign a static value to a PDF Field. The serviceNowField
and catalogVariable properties should be omitted in this case. Value can also be used to specify the value that is set to a field when a checkbox is checked rather than true/false.

Type: string, number, or true/false

choices (optional)

An array of choices used for choice fields and reference fields.

Type: Array of ICustomFieldChoice (defined bellow)

options (optional)

A set of field options that will affect how the field is edited.

Type: ICustomFieldOptions (defined bellow)

defaults (optional)

Default value for the field that will be set when the form is creating a new record.

Type: object

{
    value: 'VALUE'; // string, number, or true/false
    display: 'DISPLAY VALUE'; // string
}

ICustomFieldChoice

value

The internal value this choice sets the field to.

Type: string

display

The value this choice displays to the user.

Type: string

order

The order this choice should appear in the list of choices.

Type: number

dependent (optional)

The value of the field that this choice field depends on needs to have before this choice is shown in the choice list.

Type: string

ICustomFieldOptions

limit (optional)

The max number of options presented by a reference field at once. Default is 50 if no value is provided.

Type: number

orderBy (optional)

The name of the field to sort reference field choices by.

Type: string

table (optional)

The name of the table a referance field referances.

Type: string

qualifier (optional)

An encoded query to filter a reference fields options

Type: string

lookup (optional)

If true looks up choices for reference fields.

Type: true/false

mask (optional)

This option can be used on string fields to set up a masked input. It specifies the format for the string field.

Mask Element Description
0 Digit required. This element will accept any single digit from 0 to 9.
9 Digit or space, optional.
# Digit or space, optional, Plus(+) and minus(-) signs are allowed.
L Letter required. It will accept letters a-z and A-Z.
? Letter or space, optional.
& Requires a character.
C Character or space, optional.
A Alphanumeric (A-Za-z0-9) required.
a Alphanumeric (A-Za-z0-9) or space, optional.
< Shift down. Converts all characters to lower case.
> Shift up. Converts all characters to upper case.
| Disable a previous shift up or shift down.
\\ Escapes a mask character, turning it into a literal.
All other characters Literals. All non-mask elements (literals) will appear as themselves within MaskedTextBox.

Type: string

customMaskCharacters (optional)

Type: object

A list of key value pairs. For example:

{
    P: 'P,A,p,a', 
    M: 'M,m'
}

Defines two mask characters where P matches 'P', 'A', 'p', or 'a' and M matches 'M' or 'm'.

format (optional)

Defines the format a date field should use.

Token Output
Month M 1 2 ... 11 12
Mo 1st 2nd ... 11th 12th
MM 01 02 ... 11 12
MMM Jan Feb ... Nov Dec
MMMM January February ... November December
Quarter Q 1 2 3 4
Qo 1st 2nd 3rd 4th
Day of Month D 1 2 ... 30 31
Do 1st 2nd ... 30th 31st
DD 01 02 ... 30 31
Day of Year DDD 1 2 ... 364 365
DDDo 1st 2nd ... 364th 365th
DDDD 001 002 ... 364 365
Day of Week d 0 1 ... 5 6
do 0th 1st ... 5th 6th
dd Su Mo ... Fr Sa
ddd Sun Mon ... Fri Sat
dddd Sunday Monday ... Friday Saturday
Day of Week (Locale) e 0 1 ... 5 6
Day of Week (ISO) E 1 2 ... 6 7
Week of Year w 1 2 ... 52 53
wo 1st 2nd ... 52nd 53rd
ww 01 02 ... 52 53
Week of Year (ISO) W 1 2 ... 52 53
Wo 1st 2nd ... 52nd 53rd
WW 01 02 ... 52 53
Year YY 70 71 ... 29 30
YYYY 1970 1971 ... 2029 2030
YYYYYY -001970 -001971 ... +001907 +001971
Y 1970 1971 ... 9999 +10000 +10001
Era Year y 1 2 ... 2020 ...
Era N, NN, NNN BC AD
Note: Abbr era name
NNNN Before Christ, Anno Domini
Note: Full era name
NNNNN BC AD
Note: Narrow era name
Week Year gg 70 71 ... 29 30
gggg 1970 1971 ... 2029 2030
Week Year (ISO) GG 70 71 ... 29 30
GGGG 1970 1971 ... 2029 2030
AM/PM A AM PM
a am pm
Hour H 0 1 ... 22 23
HH 00 01 ... 22 23
h 1 2 ... 11 12
hh 01 02 ... 11 12
k 1 2 ... 23 24
kk 01 02 ... 23 24
Minute m 0 1 ... 58 59
mm 00 01 ... 58 59
Second s 0 1 ... 58 59
ss 00 01 ... 58 59
Fractional Second S 0 1 ... 8 9
SS 00 01 ... 98 99
SSS 000 001 ... 998 999
SSSS ... SSSSSSSSS 000[0..] 001[0..] ... 998[0..] 999[0..]
Time Zone z or zz EST CST ... MST PST
Z -07:00 -06:00 ... +06:00 +07:00
ZZ -0700 -0600 ... +0600 +0700
Unix Timestamp X 1360013296
Unix Millisecond Timestamp x 1.36001E+12

Type: string

precision (optional)

The number of decimal places to use in a number field.

Type: number

min (optional)

The minimum value for a number field.

Type: number

max (optional)

The maximum value for a number field.

Type: number

length (optional)

The maximum number of characters for a field.

Type: number

dependent (optional)

The dependant field for a choice field.

Type: string

showNone (optional)

Show none as an option in a choice field. Default is false.

Type: true/false

defaultCurrency (optional)

The default currency to use for a currency field. Defaults to USD.

Type: string

currencyOptions (optional)

The list of currencies that a currency field can use. Only allows USD by default.

Type: array of strings