Get Extension Assets Path with Default in SuiteScript
The getExtensionAssetsPathWithDefault helper provides a way to access extension assets in SuiteScript with a fallback option.
The getExtensionAssetsPathWithDefault helper is essential for developers working with SuiteScript, particularly in customizing extensions. This helper aids in accessing assets that are pre-included with active extensions and ensures your templates have proper asset paths configured in NetSuite. If a specific asset path isn't available, this helper allows you to define a default fallback path.
How to Use getExtensionAssetsPathWithDefault
To utilize the getExtensionAssetsPathWithDefault helper in your templates, you need to provide two arguments:
config_value: The path as configured in NetSuite.default_value: A fallback path to use if the asset isn't configured.
Example Syntax in a Template File:
You can include this helper in an HTML template as follows:
<img src="{{getExtensionAssetsPathWithDefault logo_path 'img/logo.png' }}" >Example Result:
This helper effectively returns the active extension's asset path. If the first argument is defined, it retrieves the configured path:
<MY_PATH>/img/other_logo.pngIf the config_value is undefined, the second argument is used to generate the correct path for the active extension:
<FULL_PATH>/extensions/<VENDOR>/<EXTENSION>/<VERSION>/img/logo.pngThis dual-path functionality is particularly useful for maintaining flexibility in your asset management, especially when deploying extensions across different environments.
Key Takeaways
- The helper accesses pre-existing assets for active extensions.
- It allows for configurable and fallback asset paths.
- Useful for template customization in SuiteScript.
Frequently Asked Questions (4)
How do I use the 'getExtensionAssetsPathWithDefault' helper in a SuiteScript template?
What arguments are required for the 'getExtensionAssetsPathWithDefault' method?
Can the 'getExtensionAssetsPathWithDefault' helper be used in all NetSuite environments?
What happens if the 'config_value' path is undefined when using this helper?
Was this article helpful?
More in SuiteScript
- Scheduling Map/Reduce Script Submissions in NetSuite
Learn how to schedule map/reduce scripts for one-time or recurring submissions in NetSuite, enhancing automation and efficiency.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- Attach and Detach Operations in NetSuite 2026.1
Attach and detach operations for record relationships in NetSuite enhance data management and connectivity.
