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.
Source: This article is based on Oracle's official NetSuite documentation.
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 Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category