Working with Mobile States as Data Source

Mobile states store data to make them available within the app. Data captured from a process page can be stored in the state and accessed on succeeding pages within the mobile process. At the end of a process flow, the stored data can be saved to a NetSuite record or transaction. Data from custom fields that you add to standard or custom mobile processes can only be saved on NetSuite transactions.

Depending on your app requirements, you can add more data to the state. When you add or customize a page element, you can set it up to capture data to be stored in the state or display data from the state. For certain mobile actions associated with a page or page element, you can use state data to set up parameters.

Mobile apps store data in key-value pairs. State keys serve as unique identifiers to the data or values that are gathered from page elements or fields. In the following example, the list of state keys with sample values, to the right of the colon, pertain to item data:

These are some of the keys that are stored in the state for the Enter Quantity page of the PO Receiving process. When you select an item from the previous page, you can access the corresponding state data on the Enter Quantity page.

To use key-value pairs from mobile states, see the following topics:

Storing Data in the State

You can customize page elements to capture data and store them in mobile states. On succeeding process pages within the mobile process, you can access and use the stored data.

You can store the data you enter or select in a field. You can also store data sourced directly from a NetSuite record or saved search. At the end of a process flow, the state data captured for the mobile process is cleared.

When you add a custom field through mobile configuration or customization, you can also set it up to store data in the state. The name you assign to your custom field or page element is used as the name of the key, which holds its data. The customization fields that you can set up to store data depend on the page element type and source data, as shown in the following table:

Element Type

Required Fields and Sample Settings

State Path *

Drop Down

Text Box

Date

To store data for body fields of a NetSuite record, set the following fields:

Record Name - employee

Field Name - firstname

Given the sample settings, the data stored is for the firstname field of the employee record.

state:dataRecord:<record>:<field>

Example: If the element’s name is first_name, the path to the key is as follows: state:dataRecord:employee:firstname:first_name

 

To store data for a sublist field or saved search, set the following fields:

Record Name - employee

Sublist Name - emergencycontact

Field Name - firstname

Given the sample settings, the data stored is for the firstname field within the emergencycontact sublist of the employee record.

state:dataRecord:<record>:<sublist>:<field>

Example: If the element’s name is first_name, the path to the key is as follows: state:dataRecord:employee:emergencycontact:firstname:first_name

 

To store data temporarily for use within the mobile process only, in the Record Name field, enter aux.

state:dataRecord:auxParams

Example: If the element’s name is first_name, the state path to the key is as follows: state:dataRecord:auxParams:first_name

Dynamic Text

Data Table

Transfer Table

Search Grid

To store data for a NetSuite record, set the following field:

Record Name - employee

Given the sample setting, the table or text data stored is for the employee record.

state:dataRecord:<record>

Example: If the element’s name is employee_table, the path to the key is as follows: state:dataRecord:employee:employee_table

* You can use the state paths to retrieve stored data from the state. See Accessing Data Stored in the State.

 

For instructions on how to access these customization fields, see Customizing Mobile Page Elements.

Aside from these page elements, you can also store data through output parameters used by RESTlets of certain mobile actions. See the following topics:

Accessing Data Stored in the State

For your customizations, you can use data stored in the state to set up dynamic values for messages, field entries, labels, input parameters, conditions, and other page element settings. Mobile states contain standard keys that you can use for pages or page elements within a mobile process. You can also use keys that hold data for custom page elements that you set up. For more information, see Storing Data in the State.

You can access data through the state path to its key. For the path, use the state keyword followed by dataRecord, the object in the state that contains data from mobile pages. Within the dataRecord object, you can find groups of keys stored in the following objects:

  • scriptParams – This object contains the standard keys for transaction and other data used within a standard mobile process.

    State path: state:dataRecord:scriptParams

    Example: state:dataRecord:scriptParams:vendorName

    This state path to the standard key, vendorName, enables you to retrieve the name of a vendor associated with a purchase order. Within the PO Receiving process, when you select a purchase order on a page, the associated vendorName key and its value are stored in the state for the succeeding mobile pages.

  • auxParams – This object contains the keys for additional data that you set up during configuration or customization. It also contains data for the warehouse location that you select on the app.

    State path: state:dataRecord:auxParams

    Example: state:dataRecord:auxParams:customVendorName

    If you store data for a custom field called customVendorName, this state path enables you to retrieve its value.

For more information, see Displaying Messages in Dynamic Text Elements or Input Parameters for Data Validation, Storage, or Submission.

Viewing State Data

When you access a mobile page, you can view state data captured from it and from the previous pages within the process flow. The values in the state appear beside their corresponding keys. Each key is named after its data source field or column.

One way of viewing state data is through a browser’s inspect element tool. If you use the Google browser, you can right-click anywhere on the mobile page and then select Inspect to display the tool. From the tool’s menu, click Application. From the left panel, under the Storage section, expand Local Storage and then click the URL for app.netsuite.com. From the right panel, in the Key column, click psg-mobile-state. From the panel below or beside it, expand dataRecord object to view the keys under auxParams and scriptParams objects.

The following screenshot shows the scriptParams keys with sample values stored in the state for the Enter Quantity page:

Mobile state details

Instead of using the browser’s tool, you can display key-value pairs from the auxParams and scriptParams objects on mobile pages. Depending on your Administrator or Manager role, access the Mobile – Settings page, and then check the Debug State box. When you access a mobile page while on Debug State mode, the state data appears at the top. For more information about mobile settings, see Configuring SCM Mobile App Settings.

Refer to the following examples of key-value pairs (“key”: value) from the state for the Enter Quantity page of the PO Receiving process:

  • auxParams object key-value pairs

    auxParams object data
  • scriptParams object key-value pairs

    scriptParams object data

Related Topics

SCM Mobile App Customization
Customizing Mobile Processes
Customizing Mobile Pages
Customizing Mobile Page Elements
Customizing Mobile Actions
SCM Mobile App Access
SCM Mobile App Basics
SCM Mobile Setup

General Notices