Mobile Form Expressions for Field Service Management
Mobile form expressions let you change form properties in response to form data. You can use expressions to create conditional questions, calculate values, update select options, apply styles, and reuse data from other Mobile resources.
An expression is a JavaScript formula assigned to a form element property. The expression references one or more element properties and returns the value to assign.
For example, consider a Job Safety Analysis form. The form displays the Customer Signature element after the technician confirms that the work is complete.
{
"done": {
"label": "Is all work complete?",
"type": "checkbox",
"value": false
},
"sign": {
"label": "Customer Signature",
"type": "signature",
"hidden": "!done.value"
}
}
When the form opens, done.value is false. The expression returns true, so the signature is hidden. When the technician taps the Is all work complete? box, the expression runs again and the signature becomes visible.
Prerequisites for Mobile Form Expressions
You should be familiar with:
-
The FSM Configuration object.
-
The elements used by the form you are customizing.
-
JavaScript expressions and data types.
-
Browser developer tools if you need to troubleshoot an expression.
Capabilities of Mobile Form Expressions
You can use expressions to:
-
Show, hide, enable, disable, or require form elements.
-
Calculate a value from other inputs.
-
Change a label, placeholder, helper text, or CSS class.
-
Populate select options from another element.
-
Store reusable calculations in custom properties.
-
Call pure functions imported from the File Cabinet.
-
Read static JSON data imported into the Mobile app.
Expressions can be assigned to supported element properties and to custom properties. The following structural properties must use static values:
-
type -
multiple -
parent
Static values ensure that the client and server use the same form structure during synchronization.