Single Page Applications as XML Definitions
The Single Page Application feature is available by request only. Currently, this feature can be enabled only for SDN partners with a publisher ID. SPA development requires the use of SuiteCloud Development Framework (SDF) SuiteApp projects and SuiteScript 2.1. For information about the requirements to use this feature and how to request access, see Requesting Access to the Single Page Application Feature.
A single page application (SPA) is a web application or site that loads a single HTML page and dynamically updates that page when the user interacts with it.
In NetSuite, you can use SPAs to build a customized user interface. SPAs are created as part of SuiteApp projects created using the SuiteCloud Development Framework (SDF). SPAs are defined in SDF as a singlepageapp
SDF custom object.
To see the list of SPAs deployed in your NetSuite account, go to Customization > Scripting > Single Page Applications.
For information about working with SPAs, see the following help topics:
Take note of the following guidelines when creating the XML definition file for a singlepageapp
SDF custom object:
-
Each SPA implementation in a SuiteApp project must have its own SPA object definition XML file stored in the
Objects
folder. -
The specified value for
scriptid
in the XML definition must match the file name of the SPA object definition file. -
The paths specified in the object definition are absolute paths relative to the root of the
src/FileCabinet/
folder. Take note of the following:-
The target location for the SPA
folder
must be insidesrc/FileCabinet/SuiteApps/<ApplicationID>/
(where the transpiled files will be saved after running the build). In the XML definition, you do not need to includesrc/FileCabinet
in the path. -
The path specified for the SPA client script (
clientscriptfile
) and SPA server script (serverscriptfile
) must point to a location inside the SPA folder. -
The assets folder is optional. If you provided a folder path in the
assetsfolder
field of the SPA object definition, then you also need to have the assets folder in the SPA folder.
For information about the project structure for SuiteApps with SPAs, see SuiteApp Project Structure for Single Page Applications.
-
-
You can set up additional configurations for the SPA, such as the log level, execute as role, audience, and links.
For information about the attributes and fields in a singlepageapp
SDF custom object, see singlepageapp.
For a complete example showing all the supported fields, see Single Page Application XML Definition Example.
The basic XML definition for an SPA object in a SuiteApp looks like the following:
<singlepageapp scriptid="custspa_helloworld">
<name>Hello World</name>
<description>This is a sample SuiteApp that uses NetSuite UIF components.</description>
<url>helloworld-suiteapp-spa</url>
<folder>[/SuiteApps/com.netsuite.spa/helloworld/]</folder>
<clientscriptfile>[/SuiteApps/com.netsuite.spa/helloworld/SpaClient.js]</clientscriptfile>
<serverscriptfile>[/SuiteApps/com.netsuite.spa/helloworld/SpaServer.js]</serverscriptfile>
<assetsfolder>[/SuiteApps/com.netsuite.spa/helloworld/assets/]</assetsfolder>
</singlepageapp>
For information about errors related to SPAs in SDF SuiteApp projects, see Troubleshooting Single Page Applications.
Related Topics
- Scripting
- User Event Scripts as XML Definitions
- Scheduled Scripts as XML Definitions
- SDF Installation Scripts as XML Definitions
- Workflows as XML Definitions
- Translation Collections as XML Definitions
- Map/Reduce Script Objects as XML Definitions
- Portlet Scripts as XML Definitions
- Client Scripts as XML Definitions
- Integration Records as XML Definitions
- Mass Update Scripts as XML Definitions
- Suitelet Scripts as XML Definitions
- RESTlet Scripts as XML Definitions
- Secrets as XML Definitions