Importing Files into the Mobile App
Use the FSM Configuration import option to load custom JavaScript (JS), JavaScript Object Notation (JSON), and Cascading Style Sheets (CSS) files from the File Cabinet. Imported files are available to the Field Service Management (FSM) Mobile app and are cached for offline use.
The import option supports FSM mobile customizations beyond form expressions. Form expressions can use imported JavaScript functions and JSON data. Imported CSS can provide custom presentation styles
This is a general Mobile customization feature. Form expressions can use imported JavaScript functions and JSON data, imported CSS can provide custom presentation styles.
Supported File Types
|
File Type |
Description |
Example |
|---|---|---|
|
JavaScript |
JavaScript files are loaded as scripts. Mobile form expressions can reference globally defined functions and variables. Use JavaScript imports for pure, reusable calculations. Do not use imported expression functions to manipulate the DOM, make network requests, or modify form state. |
- |
|
JSON |
JSON files are loaded and parsed into a global variable. The variable name is the import ID. |
Expressions and imported functions can reference the data as regionaldata_v1. |
|
CSS |
CSS files are loaded as stylesheets. Use CSS imports with element class properties to apply account-specific presentation. |
|
Register Imported Files
Add each file to the import object using a unique ID and a File Cabinet path:
{
"import": {
"customfunctions_v1": "/SuiteScripts/FieldService/custom-functions.js",
"regionaldata_v1": "/SuiteScripts/FieldService/regional-data.json",
"mobiletheme_v1": "/SuiteScripts/FieldService/mobile-theme.css"
}
}
Import IDs used by JavaScript and JSON must be valid JavaScript identifiers. Use letters, numbers, underscores, and dollar signs, and do not begin an ID with a number.
Update a Cached Import
Imported files are cached by the Mobile app for offline use. Replacing the contents of a File Cabinet file without changing its import ID may not cause devices to download the new version.
When an imported file changes:
-
Upload the updated file to the File Cabinet.
-
Change the import ID in the FSM Configuration, for example from customfunctions_v1 to customfunctions_v2.
-
Confirm that the form expressions or configuration use the new global name when the ID identifies a JavaScript or JSON file.
-
Reload the Mobile app and verify the updated behavior.
Import Safety Guidelines
-
Import only files controlled by your account administrators.
-
Keep JavaScript functions deterministic and synchronous when they are used by expressions.
-
Use unique names to prevent collisions with form elements, other imports, and browser globals.
-
Validate JSON before uploading it.
-
Test changes in a non-production account before deployment.
-
Keep imported files in source control and record the deployed import ID.