Dynamic Form Items
Dynamic form items allows you to create form items dynamically through the onLoad script in the activity template's settings.
This is a highly advanced concept and is still being improved. If you're not familiar with TilliT DO just yet, create your activity items throught the UI.
Navigation
Create an activity template. See Activity template.
Then click on Edit Template, expand the Scripts drawer.

Click on the Calculator icon to the right of the Onload Script's input field. When a modal appears, this is where we will be putting in our JSON-based script. JSON, or JavaScript Object Notation, is a widely used format for storing and exchanging data. It’s both human-readable and machine-parsable.

Add Form Items
Let’s break down these examples into simple, easy-to-understand terms. Even if you're not familiar with coding or JSON, think of this as filling out a form, where each part defines what the form will look like and how it will behave.
Here’s an example script that adds two form items:
A number input (Field 1, not required)
A text input (Field 2, required)
$formItems.push(
{
"name": "Field 1",
"hint": "Fill in",
"itemKey": "Field1",
"itemType": "DATA_ENTRY",
"dataType": "NUMBER",
"active": true
},
{
"name": "Field 2",
"itemKey": "Field2",
"itemType": "DATA_ENTRY",
"dataType": "STRING",
"active": true,
"isRequired": true
}
);
Explanation
Field 1:
Label: "Field 1."
Hint: A hint to the users.
Type: Accepts numbers only.
Active: It’s visible to users.
Field 2:
Label: "Field 2."
Type: Accepts text only (e.g., letters, words).
Active: It’s visible to users.
Required: Users must fill this field before submitting the form.
Click Save to close the modal and Save again to apply your changes.

The form will now include the items you just configured, these items' properties aren't editable through the UI but must be changed through the onLoad script that we just wrote.

Now feel free to use the references tables below to help you write your scripts, with examples included at the end.
Configuration Reference Tables
Understanding the References Table
The references tables' purposes is to help you understand how different fields and properties are structured and what kinds of information they accept. Each table provides essential details about the properties, their data types, and any associated custom types or options. Here's how to read and use it effectively:
1. Table Structure
Each table has the following columns:
Property Name: The name of the property used in the system. Think of it as a label or identifier for a specific part of the form or data.
Property: A simplified version of the property name, often the one you'd see or reference in usage.
Data Type: The kind of information this property accepts. For example:
STRING
: Text-based information like words or phrases.NUMBER
: Numeric values.Custom data types (e.g.,
TREE
,SINGLE
): Specific categories or types explained in another table.
2. Example: Option Group (Table 5)
This table explains the properties of an Option Group, a part of the form that lets users make selections:
Name of the Option Group
name
STRING
The type of the Option group
type
See Table 6: Option List Group Type
name
Property:Data Type:
STRING
This means the property accepts text, such as "Preferred Colors" or "Favorite Fruit."
type
Property:Data Type: Reference to Table 6.
You must select a predefined type from the Option Group Types table, which lists the available categories for this property.
3. Understanding Custom Data types (Table 6)
Some properties use custome data types, which are predefined values that you must choose from. For instance, the type
property in Table 5 refers to these Option Group Types:
Description
Enum Value
Tree Type, where the option items would have parents
TREE
Single Option Type
SINGLE
Multiple Choice Type
MULTIPLE
Downtime reason
DOWNTIME_REASON
How to Use Custom Enums:
Match the description to your use case.
Use the custom data types (e.g.,
SINGLE
orMULTIPLE
and not String, Text or Number) in your configuration.
4. Connecting the Tables
When a property references another table (like how type
in Table 5 points to Table 6), it means the value for that property must come from the options in the referenced table. This ensures consistency and clarity in how the data is defined and used.
Tips for Using the References Table
Identify Required Properties: Look at the Property Name and Property columns to see what information you need to provide.
Match Data Types: Make sure the values you provide match the required data type (e.g., text for
STRING
, numbers forNUMBER
, or specific date types for custom types).Follow References: If a property points to another table, review the referenced table to understand what values are valid.
Use Descriptions for Context: The descriptions in the custom enums (like
Tree Type
orDowntime reason
) help you decide which value fits your scenario.Don't forget $formItems.push(): Don't forget to add
$formItems.push(insert your form items here)
in order to actually add the items dynamically through the script.
Table 1: Activity Item Properties
A unique key for the item, all items must have different keys
itemKey*
STRING
A name for the item
name*
STRING
A hint for the activity item
hint
STRING
Whether is item is active for filling or not
active*
BOOLEAN
Make the item read-only
readOnly
BOOLEAN
Hide the tolerance target se
hideTarget
BOOLEAN
The order the activity item is displayed
displayOrder
NUMBER
Whether the item is required to fill
isRequired
BOOLEAN
Enabling taking an image from the activity item
ee
BOOLEAN
Option group items, see Option list
itemOptions
An array of Option Items. See Table 7: Option Item Properties
Allows OCR for text recognition
enableOcr
BOOLEAN
Table 2: Item Types Data Type
Item Type Name
Item Type
Data Entry
DATA_ENTRY
Order Progress
ORDER_PROGRESS
Order Reject
ORDER_REJECT
Update Order Tolerance
UPDATE_ORDER_TOLERANCE
Update Order Attribute
UPDATE_ORDER_ATTRIBUTE
Even Reason
EVENT_REASON
Raise Event
RAISE_EVENT
Material Movement
MATERIAL_MOVEMENT
Update Component Target
UPDATE_COMPONENT_TARGET
Table 3: Data Type Data Type
Data Type Name
Data Type
Numeric
NUMBER
Date
DATE
Boolean (True/False or Pass/Fail)
BOOLEAN
Date Time
DATETIME
String or Text
STRING
Calculation
CALCULATED
Evaluate String
EVALUATE_STRING
Evaluate Number
EVALUATE_NUMBER
Evaluate Boolean
EVALUATE_BOOLEAN
Digital Signature
DIGITAL_SIGNATURE
Barcode
BARCODE
Barcode_GS1
BARCODE_GS1
Option Group
OPTION
Pass/Fail
PASS_FAIL
Edge Data
EDGE_DATA
Material
MATERIAL
Note
NOTE
Image
IMAGE
Start Section
START_SECTION
End Section
END_SECTION
Asset
ASSET
Table 4: Tolerance Type Data Type
Tolerance Type Name
Tolerance Type
Material Tolerance
MATERIAL
Asset Tolerance
ASSET
Order Tolerance
ORDER
Process Variable Tolerance
PROCESS_VARIABLE
Activity Item Tolerance
ACTIVITY_ITEM
Table 5: Option Group Properties
Property Name
Property
Data Type
Name of the Option Group
name*
STRING
Table 6: Option Group Data Types
See Option list to learn more.
Tree Type, where the option items would have parents
TREE
Single Option Type
SINGLE
Multiple Choice Type
MULTIPLE
Downtime reason
DOWNTIME_REASON
Table 7: Option Item Properties
Property Name
Property
Data Type
Option Display Order
displayOrder
NUMBER
Option name
name*
STRING
Option value when submitted
value*
STRING
Whether the option being selected means a pass
pass
BOOLEAN
Whether the option is required to be chosen
required
BOOLEAN
The down time type the option represents, if the Option Group is the Downtim reason time
downtimeType
'PLANNED' | 'UNPLANNED'
The option item's parents
parent
This is for TREE type option groups to determin the tree hierarchy.
Table 8: Attribute Properties
See Attributes
Name of the attribute
name
STRING
Whether this is an order attribute
orderAttribute
BOOLEAN
Whether this is an asset attribute
assetAttribute
BOOLEAN
Whether this is a material attribute
materialAttribute
BOOLEAN
Attribute data type
dataType
BOOLEAN
NUMBER
STRING
LINK
Table 9: Event Type Properties
See Event Type for more information.
Name of the Event Type
name*
STRING
Subtitle
subtitle
STRING
Priority of the event
priority*
NUMBER
Display order
displayOrder
NUMBER
Table 11: System Event Data Type
Activity Manual Start
ACTIVITY_MANUAL_START
Activity Completed
ACTIVITY_COMPLETED
Activity Skipped
ACTIVITY_SKIPPED
Activity Expired
ACTIVITY_EXPIRED
Activity Failed
ACTIVITY_FAILED
Order Started
ORDER_STARTED
Order Resumed
ORDER_RESUMED
Order Completed
ORDER_COMPLETED
Order Ready
ORDER_READY
Order Paused
ORDER_PAUSED
Order Canceled
ORDER_CANCELED
Equipment Status Ready
EQUIPMENT_STATUS_READY
Equipment Status Running
EQUIPMENT_STATUS_RUNNING
Equipment Status Stopped
EQUIPMENT_STATUS_STOPPED
Equipment Status Complete
EQUIPMENT_STATUS_COMPLETE
Equipment Status Suspended
EQUIPMENT_STATUS_SUSPENDED
Equipment Status Starved
EQUIPMENT_STATUS_STARVED
Equipment Status Blocked
EQUIPMENT_STATUS_BLOCKED
Table 12: Material Properties
See Materials for more.
Name
name*
STRING
Whether is material is active
active
BOOLEAN
Whether the material is to be produced
canProduce
BOOLEAN
Whether the material can be consumed
canConsume
BOOLEAN
The material's unique ID
externalId*
STRING
Barcode reference
barcodeReference
STRING
Default run rate
defaultRunRate
NUMBER
Other types and properties
Examples
Data entry
{ //Number field
"name": "Number field with hint",
"hint": "Fill in",
"itemKey": "Numberfield",
"itemType": "DATA_ENTRY",
"dataType": "NUMBER",
"active": true
}

{ // Text field
"name": "Text field",
"hint": "Textfield",
"itemKey": "Textfield",
"itemType": "DATA_ENTRY",
"dataType": "STRING",
"active": true
}

Unit of Measurement
{ // Number field with UOM
"name": "Number field with unit of measurement",
"hint": "Fill in",
"itemKey": "Numberfieldwithuom",
"itemType": "DATA_ENTRY",
"dataType": "NUMBER",
"uom": { "name": "mL" },
"active": true
}

Single Option Groups
{ // Single option group
"name": "Single Option Group",
"hint": "Fill in",
"itemKey": "Single Option Group",
"itemType": "DATA_ENTRY",
"dataType": "OPTION",
"options": { "name": "Options to choose" },
"itemOptions": [
{ "name": "option1", "value": "Option 1" },
{ "name": "option2", "value": "Option 2" }
],
"active": true
},

Adding Tolerances and Limits
{ //Number field with tolerances
"name": "Number field with tolerances",
"hint": "Fill in",
"itemKey": "NumberfieldTolerances",
"itemType": "DATA_ENTRY",
"dataType": "NUMBER",
"uom": { "name": "mL" },
"toleranceType": "ORDER",
"target": "30",
"upperLimit": "50",
"lowerLimit": "20",
"active": true
}

Read-only notes
{ // Ready only note field
"name": "NoteField",
"itemKey": "NoteField",
"itemType": "DATA_ENTRY",
"dataType": "NOTE",
"calculation": "'Notes go here'", // Enclose the content in single quotes
"active": true
}

Enable Image Capture
{ // Text field with image capture
"name": "Text field with image capture",
"itemKey": "TextfieldImageCapture",
"itemType": "DATA_ENTRY",
"dataType": "STRING",
"enableImageCapture": true,
"active": true
}

Enable OCR
{ // Text field with OCR
"name": "Text field with OCR",
"itemKey": "TextfieldOCR",
"itemType": "DATA_ENTRY",
"dataType": "STRING",
"enableOcr": true,
"active": true
}

Raise Event - Pass / Fail type
{ // Text field with Raise Pass/Fail Event
"name": "Text field with Raise Pass/Fail Event",
"itemKey": "TextfieldOCR",
"itemType": "RAISE_EVENT",
"dataType": "PASS_FAIL",
"enableOcr": true,
"active": true
}

Last updated