Dynamic Form Items
Last updated
Last updated
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.
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.
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)
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.
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:
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.
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.
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
or MULTIPLE
and not String, Text or Number) in your configuration.
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.
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 for NUMBER
, 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
or Downtime 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.
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
barcodeFieldLength
STRING
barcodeFields
STRING
calculation
STRING
visibilityExpression
STRING
hiddenExpression
STRING
Make the item read-only
readOnly
BOOLEAN
lowerLimit
STRING
upperLimit
STRING
lowerWarningLimit
STRING
upperWarningLimit
STRING
target
STRING
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
Item type
itemType*
Item data type
dataType*
toleranceType
Unit of measurement
uom
options
itemOptions
component
Material
material
attribute
raiseEventType
Allows OCR for text recognition
enableOcr
BOOLEAN
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
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
Tolerance Type Name
Tolerance Type
Material Tolerance
MATERIAL
Asset Tolerance
ASSET
Order Tolerance
ORDER
Process Variable Tolerance
PROCESS_VARIABLE
Activity Item Tolerance
ACTIVITY_ITEM
Property Name
Property
Data Type
Name of the Option Group
name*
STRING
The type of the Option Group
type*
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
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.
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
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
TilliT's system event.
systemEvent*
An event that when started, closes this event.
closingEvent*
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
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
Unit of Measurement
uom
See
See
See
See Active item expression in
See Hidden Expression in
See
See
See
See
See
See
See
Tolerance type, see
See
See
Option group, see
See
Option group items, see
An array of Option Items. See
See
See
See
See
See
See
See
See
See
See
See