Setting Up Custom RESTlets

Standard mobile processes use RESTlets to perform actions like obtaining, evaluating, or submitting data, among others. The mobile app displays data in page elements, submits them to NetSuite transactions, or uses them to validate your entries. If you use Mobile Printing, supported mobile processes use RESTlets to obtain print template data, evaluate printing rules, and perform printing tasks. Depending on your app requirements, you can create custom RESTlets that perform similar or other actions within mobile processes.

You can assign custom RESTlets to mobile actions in one of the following ways:

To set up custom RESTlets:

  1. Add your custom RESTlet to the mobile app’s folder in your file cabinet. To access the folder, follow this path: SuiteBundles > Bundle <SuiteApp ID> > src. You can create a new folder or choose an existing one within it for your custom RESTlet files. See Uploading Files to the File Cabinet. For information about SuiteApp IDs, see SCM Mobile Setup.

  2. Create a script record from which you can upload, deploy, and release your RESTlet.

    Be sure to take note of the script ID and deployment ID for your custom RESTlet.

    For instructions, see Creating a Script Record.

  3. After you deploy and release your RESTlet, set it up in a page or page element by doing the following:

    1. Access the page or specific page element on which you want to set up the RESTlet.

      Note:

      For standard mobile processes, you can set up custom RESTlets on some page elements through Mobile Configuration. To access page elements through Mobile Configuration, see Configuring Mobile Page Elements.

    2. On the Mobile - Page page or Mobile - Page Element page, in the action field, you can edit the existing mobile action or add a new one.

      You can choose an action field like an On Click Action or On Load Action. Page elements for standard processes include action fields like On Click Custom Action or On Row Click Custom Action.

    3. On the Mobile – Action page, you can set up your custom RESTlet in an existing Submit Form or Forward Form type of action. You can enter the RESTlet’s script ID and deployment ID in the appropriate fields.

    You can set the other fields on the Mobile – Action page, which vary depending on the action type. For instructions, see Customizing Mobile Actions.

  4. On the Mobile – Action page, you can click the Input Parameters or Output Parameters subtab to set up parameters. To pass data from custom fields on the app to your RESTlet, add input parameters. To store the RESTlet’s response to the mobile state, you can add output parameters. You can assign conditions to any of your parameters.

To set up a new Restlet type of action, see the following example of settings for steps 3 and 4:

Example

You add a column to the items table to display the manufacturing part number (MPN) of an item within the PO Receiving process. You create a RESTlet that obtains the MPN from item records for the list of items on the purchase order being processed. To set up the RESTlet for the column through Mobile Configuration, create a Mobile – Custom Column Setup record. On this record, in the On Load Action field, add a mobile action. On the Mobile – Action page, set up a Restlet type of action by doing the following

  • In the Type field, select Restlet.

  • In the HTTP Method field, select POST.

  • In the Script ID and Deployment ID fields, enter the corresponding IDs for your custom RESTlet.

To set up the additional column, see Adding Columns Through Mobile Configuration.

After creating and saving a Restlet type of mobile action, add an input parameter that obtains the specific purchase order being processed. The app displays the list of items from the purchase order along with their MPN. To set up, on the Mobile – Input Parameter page, enter details in the following fields:

  • In the Name field, enter a unique name for the input parameter.

  • In the Value field, enter state:dataRecord:scriptParams:transactionInternalId, the path to the value from the mobile state. The transactionInternalid key in the state stores the internal ID of the purchase order being processed.

  • In the Key field, enter the key from the RESTlet that corresponds to the value that you set up.

The key-value pair for the input parameter passes the internal ID to the RESTlet to specify the purchase order from which to obtain the list of items.

For more information, see Adding Parameters to Mobile Actions.

Related Topics

General Notices