Fetch static data

Understand how static data is fetched in mobile extensions.

Overview

When an authenticated user logs in, the app checkes if any mobile extentions are defined and if any changes to the definition have occured since last logging in.

If the app detects changes, it will check for a linked resource zip file. If there is one and it hasn’t been downloaded, then the app downloads the file to the Temp folder and extracts the contents into DocumentDirectory/mex/resource/{resourceId}/.

Fetching static resources

When the mobile extension needs to fetch a resource, it constructs a request to the File URL Translator.

The File URL Translator asks the device’s operating system to construct a dynamic URL based on the resource’s name (static URLs are not used for security reasons). The extension can then use the URL to retrieve the file metadata and read its contents.

Fetch vocabulary or picklist data

Custom functions or GraphQL fetch these types of data in the same way. For example, the following could be used in the staticFetch file:

{
  "type": "GraphQl", // Same for Custom function way
  "__vocabulary": {
    "PlantTypeVocab": "ReplacementTicketLineItem:PlantType"
  }
}

In the example above, ReplacementTicketLineItem is the object type name and PlantType is the field type name that will use the picklist.

From a mobile extention UI perspective, in order to access this list, you will need to make a call from the sharedData context:

sharedData.__vocabulary.PlantTypeVocab

The vocabulary is returned in the following format (from a staticData perspective):

{
  "__vocabulary": {
   "PlantTypeVocab": ["Type 1", "Type 2", "Type 3"]
  }
}

Picklist and vocabulary data are mainly used in Selector and multi-selector components.