Period Object Members Overview in SuiteScript
Period Object Members in SuiteScript allow developers to manage time periods in queries, enhancing data retrieval capabilities.
The Period Object in SuiteScript is crucial for managing time intervals within queries. It simplifies the process of creating conditions based on time, enhancing the overall querying capabilities. The object provides various properties to facilitate nuanced date handling in script-based queries.
What Are the Members of the Period Object?
The following table summarizes the key members available in the query.Period object:
| Member | Type | Return Type/Value Type | Supported Script Types | Description |
|---|---|---|---|---|
| Period.adjustment | Property | string (read-only) | Client and server scripts | The adjustment of the period. Uses values from the query.PeriodAdjustment enum. |
| Period.code | Property | string (read-only) | Client and server scripts | The code of the period. Utilizes values from the query.PeriodCode enum. |
| Period.type | Property | string (read-only) | Client and server scripts | The type of the period. Based on the query.PeriodType enum. |
How to Create a Period Object
To instantiate a Period object, utilize the query.createPeriod(options) function. This method allows you to specify various attributes such as the period code, adjustment, and type. Here’s a basic example of creating a Period object:
var myPeriod = query.createPeriod({ code: query.PeriodCode.LAST_PERIOD, adjustment: query.PeriodAdjustment.ALL, type: query.PeriodType.END});Example Usage in Query Conditions
Once you have created a Period object, it can be incorporated into the values parameter of Query.createCondition(options) or Component.createCondition(options). Below is an example of how it can be used within a condition:
var myComplexCondition = myQuery.createCondition({ fieldId: 'trandate', operator: query.Operator.BEFORE, values: [myPeriod]});Important Notes
- The
adjustmentproperty defaults toquery.PeriodAdjustment.NOT_LASTunless specified otherwise. - It is logical to remember that the
Periodobject is relevant both for client and server-side scripts, providing flexibility in your implementations.
Conclusion
Understanding the Period object in SuiteScript is vital for developers who need to manage time-based queries effectively. This object not only streamlines the querying process but also enhances the capabilities of script-based data manipulation.
Source: This article is based on Oracle's official NetSuite documentation.
Key Takeaways
- The
Periodobject simplifies handling time periods in queries. - It includes properties for adjustment, code, and type.
- The object can be utilized in both client and server scripts for efficient data retrieval.
Frequently Asked Questions (4)
What script types are supported by the Period object in SuiteScript?
How is the adjustment property of a Period object set by default if not specified?
How can I create a Period object for use in SuiteScript?
How can the Period object be used in query conditions?
Was this article helpful?
More in General
- Payment Date Prediction Feature in NetSuite
Payment Date Prediction in NetSuite utilizes machine learning to enhance financial planning by predicting invoice payment dates.
- NetSuite Ship Central Enhancements for Packing & Shipping
NetSuite Ship Central features enhance packing and shipping operations for improved efficiency and accuracy.
- New Role Setup for NetSuite AI Connector Service in 2026.1
The 2026.1 release adds a new role requirement for the NetSuite AI Connector Service, streamlining custom tool development.
- Generative AI Features in NetSuite 2026.1
Discover new generative AI features in NetSuite 2026.1, enhancing reporting, search, predictions, and development productivity.
Advertising
Reach General Professionals
Put your product in front of NetSuite experts who work with General every day.
Sponsor This Category