Duration Object Members in SuiteScript Reference
Duration object members provide essential parameters for defining time spans in SuiteScript, supporting server-side scripts and calculations.
The Duration object in SuiteScript enables developers to define and manage duration periods effectively. It consists of specific members that facilitate handling time-related data within server-side scripts, thereby enhancing the scripting capabilities in NetSuite.
What Are the Duration Object Members?
The Duration object comprises two significant members:
| Member Name | Type | Description |
|---|---|---|
Duration.amount | number | The amount that represents the duration. |
Duration.units | Object | The units corresponding to the duration amount. |
Property: Duration.amount
- Type:
number - Description: This property captures the numeric value representing the duration amount, such as days, hours, or minutes.
- Supported Script Types: This property can be utilized in server scripts.
- Error Handling: If there is an attempt to set the value of this property after the Duration object has been instantiated, the error code
READ_ONLY_PROPERTYwill be thrown.
Property: Duration.units
- Type:
Object - Description: This property contains the specific units that are applied to the duration amount, allowing flexibility in working with various time measurements such as seconds, minutes, hours, etc.
- Supported Script Types: Like the amount property, this can also be used within server scripts.
Contextual Use
The Duration object members are primarily utilized within scripts that need to perform time calculations or when logging durations in user interfaces, workflows, or automated processes in NetSuite. For instance, if you are developing a scenario where task completion time is logged, using the Duration object supports precise tracking.
For more extensive practices and structural integration, refer to the N/workbook Module documentation. Utilizing these properties allows developers to build more robust and flexible scripts tailored to their business requirements.
Frequently Asked Questions (4)
Can the Duration.amount property in SuiteScript be modified after the object is created?
What are the supported script types for utilizing Duration object members in NetSuite?
How does the Duration.units property enhance time-related scripting in NetSuite?
Is the Duration object suitable for task completion time tracking in NetSuite scripts?
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.
