FSM Mobile Select Option Sources and Behavior
A Field Service Management (FSM) Mobile select element can use a NetSuite search definition or an expression as its option source. Each option requires an id and a label.
The following example uses a NetSuite search definition to find active Asset records. The search applies the text entered in the search interface for the select element and maps each matching record to an option:
"asset": {
"type": "select",
"label": "Asset",
"search": true,
"remote": true,
"options": {
"record": "customrecord_nx_asset",
"filters": [
["isinactive", "is", "F"],
"and",
[
"formulatext:{name}||' '||nvl(trim({custrecord_nx_asset_customer.firstname}||' '||{custrecord_nx_asset_customer.lastname}),{custrecord_nx_asset_customer.companyname})",
"contains",
"${ options.search || '' }"
]
],
"map": {
"id": "internalid",
"label": "name",
"optgroup": "formulatext:nvl(trim({custrecord_nx_asset_customer.firstname}||' '||{custrecord_nx_asset_customer.lastname}),{custrecord_nx_asset_customer.companyname})",
"customer": {
"id": "custrecord_nx_asset_customer",
"label": "formulatext:nvl(trim({custrecord_nx_asset_customer.firstname}||' '||{custrecord_nx_asset_customer.lastname}),{custrecord_nx_asset_customer.companyname})"
}
}
}
}
record and filters define the NetSuite search. map transforms every matching search result into an option object. The map definition must produce an id and a label for each option object. FSM Mobile cannot use a result as an option if either property is missing. The map can also produce additional properties. In this example, optgroup controls the option group displayed in the list of options and customer retains related customer data for expressions that use asset.options.
An expression-based option source follows the same rule: it must return an array of objects containing id and label. For example, an expression can return or filter another element's option list, such as consumable.options. Additional mapped properties remain available in the option array, but only id and label are retained in the select element's value after selection.
Each option requires an id and a label. Use a unique string id within the option list. The label is the text shown to the user.
|
Option property |
R |
Accepted value |
Behavior |
|---|---|---|---|
|
|
Yes |
String |
Identifies the option. FSM Mobile stores this value in the |
|
|
Yes |
String |
Text displayed for the option. FSM Mobile stores this value in the |
|
|
No |
|
Marks an option as a default candidate when creating a record. For an element that permits one selection, mark only one option as selected. For an element that permits multiple selections, configure the default with an array of |
|
|
No |
String |
Places the option under a named group heading in the list. |
|
|
No |
|
Displays the option but prevents the user from selecting it. |
|
Additional string property, such as |
No |
String |
Keeps supplementary information with the option. When |
Select Defaults and Stored Values
When creating a record, if value is omitted for a select element that permits one selection, an option marked as selected supplies the initial value. If no option is selected and autoselect is true, FSM Mobile selects the only option when the list contains exactly one option. Otherwise, the initial value is null. For a multi-select element, the empty initial value is [].
An explicitly configured value takes precedence over option defaults. After selection, value retains only the selected option's id and label. Additional option properties remain available in options. To retrieve an additional property, use an expression that finds the selected id in options.
Option Search Behavior
The search property controls the search interface for the select element. For local options, FSM Mobile compares the search text with every string-valued property on each option. FSM Mobile can find an option by matching search text against a property such as altname, even when that property is not displayed. The option's label remains unchanged. When an element uses a NetSuite search definition and remote is true, FSM Mobile retrieves matching options on demand.