Configuring FSM Mobile Select Elements
This topic is intended for administrators and developers who configure Select elements in Field Service Management (FSM) Mobile.
In FSM Mobile, use the options property of a select element to define the available choices. options is not the selected value or a single option ID. It supplies the list from which the element's value is selected.
You can supply that list in three ways:
-
Static options - Configure an array of option objects directly on the element.
-
An expression - Configure an expression that returns an array of option objects. The expression can reuse or filter the option list of another element or resource, for example,
consumable.options. -
A NetSuite search definition - Configure an option source that identifies the record to search and the fields to use for option IDs and labels. FSM Mobile runs the search and resolves the results to an option array at runtime.
In every case, the resulting options value must be an array of option objects. Configure a static value, or a value expression, separately when you need to set the initial selected option or options.
This topic includes the following sections:
Option Objects and Sources
Each option requires a unique string id and a string label. The label is displayed to the user. An option can also contain properties used for defaults, grouping, or filtering. The following table lists option properties, accepted values, and behavior.
|
Option Property |
Required |
Accepted Value |
Behavior |
|---|---|---|---|
|
|
Yes |
String |
Identifies the option. Retained in the selected value. |
|
|
Yes |
String |
Displayed option text. Retained in the selected value. |
|
|
No |
|
Supplies a default selection when the element has no explicit |
|
|
No |
String |
Groups options under a displayed heading. |
|
|
No |
|
Prevents selection of the option. |
|
Additional properties |
No |
Values required by the configuration. |
Remain in the option list for expressions to use. Local search also checks string-valued properties, such as |
For example, this fragment supplies a static option list and one default selection:
{
"inspection_result": {
"type": "select",
"label": "Inspection Result",
"autoselect": false,
"options": [
{ "id": "pass", "label": "Pass", "selected": true },
{ "id": "fail", "label": "Fail" }
]
}
}
A NetSuite search-based source supplies the same option structure through record, filters, and map. The map must return id and label. It can also return other properties. For remote searching, configure the source to use the request's search text. Setting remote and search alone doesn't create a suitable search filter.
For detailed search definitions and mapping syntax, see FSM Searches and Field Mapping. For expression syntax and template tag handling, see FSM Expressions and Template Tags.
Select Defaults and Stored Values
When value is omitted, options marked selected: true supply the initial selection. Single-select uses one marked option, and multiselect uses the marked options. An explicitly configured value takes precedence. In a single-select list, set autoselect: true to select the sole option automatically. Set autoselect: false to prevent that automatic selection. Configure autoselect explicitly when the distinction matters. The empty value is null for single-select and [] for multiselect.
After a Select has initialized, changing its options can remove selections whose IDs no longer appear in the list. Options marked selected: true can then supply a replacement value. If autoselect permits it, automatic selection of the sole option can also supply a replacement value. A value supplied initially is not guaranteed to remain unchanged after the options change.
multiple can use a Boolean expression. When it resolves to false, value must be one { id, label } option object or null. When it resolves to true, value must be an array of these option objects. [] means no selection. A value expression must return the format required by the resulting selection mode. Don't assume that changing multiple automatically converts an existing value to that format.
A Select value retains only the selected option's id and label. It doesn't retain selected, optgroup, disabled, altname, or other additional option properties. Use an expression that looks up the selected id in options when another option property is needed.
Option Search Behavior
The search property controls the Select search interface. For local options, FSM Mobile compares the search text with every string-valued property on each option. You can therefore find an option using a property that isn't displayed, such as altname, without changing the option's label. When an element uses a NetSuite search definition and remote is true, FSM Mobile retrieves matching options on demand.