FSM Searches and Field Mapping

Note:

This topic is intended for administrators and developers who configure searches and field mappings.

Field Service Management (FSM) configuration uses NetSuite searches to retrieve jobs, records, and option lists. Field mappings determine which values are returned and, for editable FSM Mobile resources, which NetSuite fields receive the saved values.

A search filter selects records. A map defines the values returned from those records. A map can also define the destination fields used when saving a resource's record. Changing a filter doesn't create a field mapping, and adding an element doesn't necessarily map its value to a NetSuite field.

This topic covers:

Search and Map Configuration Locations

The following locations serve different purposes. Paths in this table start within the "routes/mobile" configuration object.

Configuration Location

Purpose

event.article.task.filters and .map

Select CRM Task events and provide their event data.

event.article.projecttask.filters and .map

Select Project Task events and provide their event data.

user.employee.map

Provide mapped data for employees. The standard employee search uses user.employee.filters, but a custom override of those filters is removed before configuration merging.

<resource ID>.article.filters and .map

Select the records displayed by a resource and map their values for loading and saving.

<resource ID>.article.filterby

Select a subset of the retrieved articles by matching their mapped properties.

<resource ID>.element.<element name>.options

Supply an option list, such as the choices in a Select element.

<resource ID>.element.<element name>.value

Supply an element's value from a search where that value has a compatible data shape.

<resource ID>.element.<element name>.map

Supply an element's mapping when the resource uses Automap and no matching article mapping already exists.

Event Data and Resource Record Data

For properties removed before merging, including the employee-filter restriction, see How Custom Configuration Combines with Standard Configuration in FSM Configuration.

An event map, such as event.article.task.map or event.article.projecttask.map, supplies information about the current job or event in FSM Mobile. Its property names identify values available through event, such as event.customer or event.supportcase. These names can differ from the NetSuite field IDs used to retrieve the values.

A resource's article.map instead supplies values for the record displayed or edited by that resource. Its property names should match the element names that display or edit those values.

For example, the standard CRM Task event map reads the linked case ID from case.internalid and uses supportcase as the write field. A resource can use the resulting event data to filter its own records. Adding a property to the event map doesn't automatically add an element or a save mapping to that resource.

For information about the syntax and scope of event, user, and template tags, see FSM Expressions and Template Tags. Preserve the standard event properties and filters required by existing FSM Mobile behavior when extending an event definition.

Defining a Search

A search definition identifies a NetSuite record type, the records to select, and the values to return. The following table describes its properties.

Property

Accepted Value

Default When Omitted

Effect

record

NetSuite record type ID, such as task, supportcase, or item.

No record type is supplied by the search definition itself.

Identifies the records to search.

filters

NetSuite filter expression, mapped filter object, internal ID or array of IDs, or true.

The standard search helper supplies an inactive-record filter when no filters are supplied. Other configuration can supply filters before the search runs.

Restricts the results. Use explicit filters appropriate to the record type. For information about accepted filter forms, see Other Filter Forms.

map

Mapping string, object, or array.

The standard search helper returns internal IDs. Article models can add their own ID mapping.

Defines the returned values and their shape.

objectify

true or false, for resolved template-data searches.

true in standard search retrieval, unless an effective definition sets false.

Selects mapped values or native search results. For information about mapped values and native search results, see Returning Mapped Values or Native Search Results.

all

true or false.

false in standard search retrieval.

Enables retrieval beyond the first 1,000 search rows in supported locations. For information about search retrieval limits, see FSM Search Retrieval Limits.

result

A nonnegative integer identifying a result position, starting at 0.

The complete retrieved result array.

In a resolved search, returns only the mapped value at that position. For information about selecting one search result, see Selecting One Search Result.

cache

true or false.

true for resolved searches, unless the calling operation overrides it.

In a resolved search, permits reuse of matching results available in the server search cache. For information about search-cache reuse, see Reusing Search Results.

The following search can supply Select options for CRM tasks assigned to the employee currently signed in to FSM Mobile. Each option contains the task's internal ID and title:

            {
  "record": "task",
  "filters": ["assigned", "anyof", "${user.internalid}"],
  "all": true,
  "map": {
    "id": "internalid",
    "label": "title"
  }
} 

          

Place this object in an element's options property, or in a loaded supporting resource that supplies shared options. It is a search definition, rather than a complete configuration file.

The search must be valid for the selected record type and the permissions used to run it. Use NetSuite field and join IDs, rather than field labels shown on a form. A field available on a record form is not necessarily available as a search column with the same ID.

Selecting One Search Result

For a resolved search, such as an element's value search, result: 0 returns the first mapped value rather than an array containing that value. The result: 1 setting returns the second value, and so on. It doesn't limit the underlying search to that many rows.

The following search definition can supply a single Select value for the case linked to the current event:

              {
  "record": "supportcase",
  "filters": ["internalid", "anyof", "${ event.supportcase || 0 }"],
  "map": {
    "id": "internalid",
    "label": "casenumber"
  },
  "result": 0
} 

            

Place this object in the Select element's value property. Its options must separately provide the available choices. If the search returns no row at the requested position, it supplies no value. The result property doesn't provide a fallback. When more than one record can match, define the search order before relying on the first result. This property is not a result-selection control for a direct article model.

The following fragment shows the default flags for a resolved template-data search. To complete the search definition, supply its record, filters, and required map:

              {
  "objectify": true,
  "all": false,
  "cache": true
} 

            

Additional Information

Related Topics

General Notices