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.
Properties | Description |
id | Required, string |
type | Required, string, possible values: “text”, “number”, “date”, “boolean”, “options”, “lookup”, “paragraph”, “hidden” or “break” |
label | Optional, String or ILabel |
helpText | Optional, String or ILabel |
required | Optional, boolean (not applicable for hidden and paragraph fields) |
disabled | Optional, boolean (not applicable for hidden and paragraph fields) |
visible | Optional, boolean (not applicable for hidden fields) |
value | Optional |
Text Field
Properties | Description |
minLength | Optional, number of minimum allowed characters |
maxLength | Optional, number of maximum allowed characters |
multiline | Optional, boolean |
rows | Optional, whole number, only applicable if multiline is true |
regEx | Optional, regular expression for validating the value |
Number Field
Properties | Description |
numType | Required, 0 = whole number, 1 = decimal |
precision | Required if numType is decimal |
min | Optional, minimum numeric value |
max | Optional, maximum numeric value |
format | Optional, string, possible values: “slider” |
Date Field
Properties | Description |
firstWeekDay | Optional, number (0 = Sunday, 1 = Monday, 2 = Tuesday, etc.), if not set then default is 1 |
Boolean Field
Properties | Description |
format | Optional, string, possible values: “checkbox” (default) or “toggle” |
trueLabel | Optional, string, only applicable if format is “toggle” |
falseLabel | Optional, string, only applicable if format is “toggle” |
Options Field
Properties | Description |
options | Required, array of IOptionValue or IOptionSet |
multiSelect | Optional, boolean (default false) |
format | Optional, string, possible values: “dropdown” (default), “radio” (only when multiSelect = false), “checkbox” (only when multiSelect = true). |
Lookup Field
Properties | Description |
entityType | Required, string, logical name of the entity |
multiSelect | Optional, boolean (default is false) |
viewId | Optional, string, id of the view |
filters | Optional, string, for example: <filter type=’and’><condition attribute=’statecode’ operator=’eq’ value=’0′ /></filter> |
Break Field
Properties | Description |
lines | Optional, number |
IOptionValue
Properties | Description |
value | Required, number or string |
label | Required, string or ILabel |
IOptionSet
Properties | Description |
optionSetName | Name of the optionSet |
entityType | Only applicable (and required) if the optionsetName does not refer to a global optionset |
stateCode | Only 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.