PositionUnits Object Members in SuiteScript 2.1
PositionUnits object members offer key properties for defining a position in SuiteScript, enhancing workbook functionality.
TL;DR Opening
The PositionUnits object in SuiteScript provides essential properties for defining a position with specific units and coordinates within a workbook. Understanding its members is crucial for effective script development.
What is the PositionUnits Object?
The PositionUnits object is used to define a position within a workbook using numeric values and associated units. It plays a significant role in various scripting contexts, particularly in the creation and manipulation of workbook elements.
PositionUnits Object Members
The following members are available within the workbook.PositionUnits object:
| Member Name | Type | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|---|
PositionUnits.unit | string | string | Server scripts | The units for the position. |
PositionUnits.x | number | number | Server scripts | The x-coordinate of the position. |
PositionUnits.y | number | number | Server scripts | The y-coordinate of the position. |
How to Create a PositionUnits Object
To create a PositionUnits object, utilize the workbook.createPositionUnits(options) method:
1// Example of creating a PositionUnits object2var myPositionUnits = workbook.createPositionUnits({3 unit: workbook.Unit.CM,4 x: 3,5 y: 36});Important Properties
- unit: The property
PositionUnits.unitspecifies the measurement units for the position. This is critical for ensuring that the position is defined correctly in the context of workbook dimensions. - x: Represents the horizontal position. It is denoted as a numeric value.
- y: Represents the vertical position. It is also a numeric value.
Error Handling
Be mindful of the potential errors when working with the PositionUnits object:
INVALID_UNIT: Thrown if the specified value forunitis not included in theworkbook.Unitenumeration.WRONG_PARAMETER_TYPE: This occurs if the value specified is not of string type for theunitproperty.
Who This Affects
This information is particularly relevant for:
- Developers who are working with SuiteScript for custom workbook implementations.
- Administrators managing and scripting around workbook functionalities in NetSuite.
Key Takeaways
- The PositionUnits object is vital for defining positions within a workbook.
- It includes properties for units of measure, as well as x and y coordinates.
- Proper understanding and implementation can significantly enhance workbook functionality within SuiteScript.
Frequently Asked Questions (4)
What are the main components of the PositionUnits object in SuiteScript 2.1?
How do I create a PositionUnits object using SuiteScript 2.1?
What error might I encounter if I provide an unsupported unit in a PositionUnits object?
Are there any script types where the PositionUnits object can be used?
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.
