Using the Include Tag for SSP Files in NetSuite

The include tag simplifies referencing scripts in .ssp files, enhancing organization within SSP applications.

·2 min read·View Oracle Docs

The include tag is recommended for use in .ssp files to maintain a clean and efficient method of referencing scripts. This approach is superior to listing scripts as library files, fostering better code organization and accessibility.

How to Upload Assets to an SSP Application Folder

After creating an SSP application record, you can upload scripts, images, and other assets for your web store customization. Follow these steps to upload assets:

  1. Go to Commerce > Hosting > Website Hosting Files.
  2. Select the appropriate Web Site Hosting Files folder and then the corresponding SSP Applications folder.
  3. Choose the application publisher and the SSP application folder to modify.
    • Create new subfolders such as style sheets, images, JavaScript, and SuiteScript within your SSP application folder.
    • Add files as necessary.
    • For further details on uploading files, refer to the File Cabinet Overview documentation.

Note: SuiteScript developers must upload .ssp and .ss files to the SSP Applications folder, not the SuiteScript folder in the File Cabinet.

How to Use the Include Tag

In your .ssp files, use one of the following formats to include scripts:

suitescript
<%@include file='file'%>
<%@include file='/path'%>

Notes on Path Referencing

  • If the path begins with /, it is relative to the root folder of the SSP application.
  • If it does not start with /, the reference points to a file in the same folder as the asset that is referencing it.
  • Files from outside the SSP application cannot be accessed via the include tag.

Benefits of Using the Include Tag

  • Improved Organization: Utilizing the include tag helps keep your codebase cleaner, reflecting a more modular structure.
  • Ease of Maintenance: Changes to referenced scripts need only be made in one location, reducing the chance of error and simplifying updates.

Related Topics

  • Enable Required Features for SuiteScript 1.0 SSP Applications
  • Create a SuiteScript 1.0 SSP Application Record
  • Set Execute as Role Permissions for .ss and .ssp Files
  • Link a Website or Domain to an SSP Application
  • Debug a SuiteScript 1.0 SSP Application

By following these guidelines on the include tag and managing your SSP assets effectively, you ensure a streamlined development process for your web store.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • Use the include tag for better script management in .ssp files.
  • Organizing scripts within subfolders enhances clarity.
  • Paths can be absolute or relative based on structure.
  • Upload scripts specifically to the SSP Applications folder.

Frequently Asked Questions (4)

Does the include tag for SSP files apply to both NetSuite versions 1.0 and 2.0?
The article specifically addresses SuiteScript 1.0 SSP Applications. For SuiteScript 2.0, different practices may apply, depending on the SSP application record setup.
What paths should be used with the include tag in .ssp files?
Path references with the include tag in .ssp files can be absolute (starting with '/') to denote the root of the SSP application or relative (without '/') to specify a file in the same folder as the referencing asset.
Can the include tag reference files outside the SSP application using an absolute path?
No, the include tag in .ssp files cannot access files outside the SSP application folder, even if using an absolute path.
Where should SuiteScript developers upload .ssp and .ss files?
Developers should upload their .ssp and .ss files to the SSP Applications folder, not within the SuiteScript folder in the File Cabinet, to ensure proper referencing and functionality.
Source: Using the include Tag instead of Library Files Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in SuiteScript

View all SuiteScript articles →