Aspect Object Members in SuiteScript for Workbook API
Aspect object members in SuiteScript define measures and types within the Workbook API for effective data handling.
TL;DR Opening
The Aspect object members in SuiteScript facilitate the handling of data measures and types within the Workbook API, enhancing scripting flexibility and data interaction. Understanding these properties is crucial for effective script development.
What is the Aspect Object?
The Aspect object is part of the Workbook API, which allows developers to create and manipulate data visualizations directly in SuiteScript. By utilizing the Aspect object, you can define specific data measures and types necessary for your workbook operations.
What Members Does the Aspect Object Include?
The Aspect object includes several key members:
| Member Name | Type | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|---|
| Aspect.measure | workbook.CalculatedMeasure or workbook.DataMeasure | Measure of the aspect. | Server scripts | Represents the measurement aspect of the object. |
| Aspect.type | string | The type of the aspect. | Server scripts | Specifies the kind of aspect using workbook.AspectType. |
Syntax for Creating an Aspect
To create an Aspect object, you can utilize the following code structure, which highlights both basic and complete examples:
1// Create a basic Aspect2var myAspect = workbook.createAspect({3 measure: myMeasure,4});5 6// Create a complete Aspect7var myAspect = workbook.createAspect({8 measure: myMeasure,9 type: workbook.AspectType.COLOR10});How to Access Aspect Members
After creating an Aspect object, it’s possible to access its various properties, as shown here:
1// Load a workbook and view an aspect in a Chart2var myWorkbook = workbook.load({3 id: myWorkbookId4});5var myAspect = myWorkbook.charts[0].series[0].aspect[0];6 7log.audit({8 title: 'Aspect type = ',9 details: myAspect.type10});11log.audit({12 title: 'Aspect measure = ',13 details: myAspect.measure14});Error Handling
When working with the Aspect members, be aware of the following error code that may be thrown:
- WRONG_PARAMETER_TYPE: This error occurs if the provided value for
Aspect.measureis not of typeworkbook.CalculatedMeasureorworkbook.DataMeasure.
Who This Affects
- Developers: Ensures they can effectively utilize the Workbook API to create dynamic reports.
- Administrators: Assists in managing workbook creation and data visualization tasks efficiently.
Key Takeaways
- The Aspect object enhances data handling within the SuiteScript Workbook API.
- Key properties include
measureandtype, defining how data is represented. - Error handling is crucial for preventing incorrect data types during variable assignments.
Frequently Asked Questions (4)
What script types support the Aspect object in SuiteScript?
What error might occur when working with Aspect.measure, and how can it be avoided?
Can an Aspect object have both measure and type properties defined?
How do I access an Aspect object's properties in a SuiteScript workbook?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- 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.
- 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.
