On the document action template you can define Custom Inputs, so the user can/must fill in extra info for using in the document flow.

Custom Inputs can be defined with the following definition in JSON.

Fields

Each field contains an unique id (required), a type (required), a label (optional), helpText (optional), an indicator if a value is required (optional) or if a field is disabled (optional) and a default value (optional). Depending on the field type other properties may be required.

Available types of fields: text, number, date, boolean, options, lookup, hidden and break.

Property “label” and “helpText” can be a single string or an object with the supported lcid’s as property.

These properties are required: “id” and “type”. Property “label” is recommended.

{
  "fields": [
   {

    "id": "field1",

    "type": "text",

    "minLength":10,

    "maxLength":100,

    "required": true,

    "disabled": false,

    "label": { "1033": "Field 1", "1043": "Veld 1" },

    "helpText": { "1033": "More info...", "1043": "Meer informatie..." },

    "errorMessage": { "1033": "Required", "1043": "Verplicht" },

    "value": "test"

  }
 ]
}

 Text Field

Single line text

{   “id”: “lastname”,   “type”: “text”,   “maxLength”:100,   “label”: { “1033”: “Last name”, “1043”: “Achternaam” } }

Multiline text

{   “id”: “description”,   “type”: “text”,   “multiline”: true,   “rows”: 5,   “maxLength”:500,   “label”: { “1033”: “Description”, “1043”: “Omschrijving” } }

 Number Field

Whole number

{   “id”: “age”,   “type”: “number”,   “numType”: 0,   “min”: 0,   “max”: 150,    “label”: { “1033”: “Age”, “1043”: “Leeftijd” } }

Use optional property “format”: “slider” to show the number field as a slider.

Decimal number

{   “id”: “amount”,   “type”: “number”,   “numType”: 1,   “precision”: 2,   “min”: -9999999,   “max”: 9999999,    “label”: { “1033”: “Amount”, “1043”: “Bedrag” } }

Date Field

{   “id”: “birthdate”,   “type”: “date”,   “firstWeekDay”: 1,  “allowTextInput”: true, “label”: { “1033”: “Birthdate”, “1043”: “Geboortedatum” } }

Lookup Field

{   “id”: “accountid”,   “type”: “lookup”,   “entityType”: “account”,   “label”: { “1033”: “Account”, “1043”: “Organisatie” } }

You can also set the optional property “filters” if needed:

  “filters”: “<filter type=’and’><condition attribute=’statecode’ operator=’eq’ value=’0′ /></filter>”

Options Field

Custom options

{   “id”: “myoptions”,   “type”: “options”,   “options”: [     { “value”: 1, “label”: { “1033”: “Option 1”, “1043”: “Optie 1” } },     { “value”: 2, “label”: { “1033”: “Option 2”, “1043”: “Optie 2” } },   ],   “label”: { “1033”: “Make a choice”, “1043”: “Maak uw keuze”} }

Property “label” of an option can be a single string or an object with the supported lcid’s as property.

{   “id”: “myoptions”,   “type”: “options”,   “options”: [     { “value”: 1, “label”: “Option 1” },     { “value”: 2, “label”: “Option 2” },   ],   “label”: “Make a choice”

Global optionset

{

  “id”: “language”,

  “type”: “options”,

  “options”: { “optionsetName”: “new_languagecode” },

  “label”: { “1033”: “Language”, “1043”: “Taal” }

}

Entity field optionset

{   “id”: “gender”,   “type”: “options”,   “options”: { “optionsetName”: “gendercode”, “entityType”: “contact” },   “label”: { “1033”: “Gender”, “1043”: “Geslacht” } }

Statuscode optionset

{   “id”: “status”,   “type”: “options”,   “options”: {     “optionsetName”: “statuscode”, “entityType”: “contact”, “stateCode”: 1   },   “label”: { “1033”: “Deactivate reason”, “1043”: “Reden van deactiveren” } }

An option field will display as a dropdown by default. Optional property “format” with value “radio” will display the field as a radiobuttons.

For multiple select use

  “multiSelect”: true,

The value for this field will be a comma separated string with the selected value(s).

Default the field will be displayed as dropdown, to display as checkboxes use “format”: “checkbox”.

Boolean Field

{   “id”: “question”,   “type”: “boolean”,   “label”: { “1033”: “Question”, “1043”: “Vraag” } }

This shows the field as a checkbox, to show the Boolean field as a toggle, use this:

{

  “id”: “question”,

  “type”: “boolean”,

  “format”: “toggle”,

  “trueLabel”: { “1033”: “Yes”, “1043”: “Ja” },

  “falseLabel”: { “1033”: “No”, “1043”: “Nee” },

  “label”: { “1033”: “Question”, “1043”: “Vraag” }

}

Property “trueLabel” and “falseLabel” can be a single string or an object with the supported lcid’s as property.

Paragraph Field

A paragraph field holds textblock as readonly.

{   “id”: “mysecret”,   “type”: “paragraph”,   “value”: “some text” }

Hidden Field

A hidden field holds data without displaying it.

{   “id”: “mysecret”,   “type”: “hidden”,   “value”: “test” }

Break Field

{

  “id”: “mybreak”,

  “type”: “break”,

  “lines”: 2

}

Prefill Field Value

Text Field:

  “value”: “test”

Number Field value as whole number:

  “value”: 1

Number Field value as decimal

  “value”: 2.95

Options Field single select:

  “value”: 1

Or:

  “value”: “item1”

Options Field multi select:

  “value”: “1,2,3”

Or:

  “value”: “item1,item2,item3”

Note that the value must match with the value(s) of the options

Boolean Field

  “value”: true

Lookup Field (value must be an array!):

  “value”: [{ “id”: ” c75d505c-71c6-45f8-8b17-e8004d2275d3″, “entityType”: “account”, “name”: “Contoso” }]

Or to prefill the lookup with the recordid (from the form where you started the dialog):

  “value”: “${selectedEntityId}”

Hidden Field:

A value of an hidden field can hold any type of data (text, number, lookup, date).

Date Field:

To prefill the value with today’s date, set property “value” to “${today}”:

  “value”: “${today}”

To prefill the value with today’s date and time, set property “value” to “${now}”:

  “value”: “${now}”

To prefill fields with more complexity, use scripting at the onPageLoaded event (see paragraph “Script Page Load”).

Interfaces Definition

IField

All fields have properties id and type. Except the Break Field all fields also have property value. Except Hidden Field all fields have property visible.

PropertiesDescription
idRequired, string
typeRequired, string, possible values: “text”, “number”, “date”, “boolean”, “options”, “lookup”, “paragraph”, “hidden” or “break”
labelOptional, String or ILabel
helpTextOptional, String or ILabel
requiredOptional, boolean (not applicable for hidden and paragraph fields)
disabledOptional, boolean (not applicable for hidden and paragraph fields)
visibleOptional, boolean (not applicable for hidden fields)
valueOptional

Text Field

PropertiesDescription
minLengthOptional, number of minimum allowed characters
maxLengthOptional, number of maximum allowed characters
multilineOptional, boolean
rowsOptional, whole number, only applicable if multiline is true
regExOptional, regular expression for validating the value

Number Field

PropertiesDescription
numTypeRequired, 0 = whole number, 1 = decimal
precisionRequired if numType is decimal
minOptional, minimum numeric value
maxOptional, maximum numeric value
formatOptional, string, possible values: “slider”

Date Field

PropertiesDescription
firstWeekDayOptional, number (0 = Sunday, 1 = Monday, 2 = Tuesday, etc.), if not set then default is 1

Boolean Field

PropertiesDescription
formatOptional, string, possible values: “checkbox” (default) or “toggle”
trueLabelOptional, string, only applicable if format is “toggle”
falseLabelOptional, string, only applicable if format is “toggle”

Options Field

PropertiesDescription
optionsRequired, array of IOptionValue or IOptionSet
multiSelectOptional, boolean (default false)
formatOptional, string, possible values: “dropdown” (default), “radio” (only when multiSelect = false), “checkbox” (only when multiSelect = true).  

Lookup Field

PropertiesDescription
entityTypeRequired, string, logical name of the entity
multiSelectOptional, boolean (default is false)
viewIdOptional, string, id of the view
filtersOptional, string, for example: <filter type=’and’><condition attribute=’statecode’ operator=’eq’ value=’0′ /></filter>

Break Field

PropertiesDescription
linesOptional, number

IOptionValue

PropertiesDescription
valueRequired, number or string
labelRequired, string or ILabel

IOptionSet

PropertiesDescription
optionSetNameName of the optionSet
entityTypeOnly applicable (and required) if the optionsetName does not refer to a global optionset
stateCodeOnly applicable (and required) if optionSetName is “statuscode” (to show only the statuscodes of this statecode)

 ILabel

Object with one or more lcid’s which hold the label text.