query.createPeriod(options)
Method Description |
Creates a query.Period object. |
Returns |
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Sibling Module Members |
|
Since |
2020.1 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
string |
required |
The code of the period to create. Use a value from the query.PeriodCode enum for this parameter. |
|
string |
optional |
The adjustment of the period to create. Use a value from the query.PeriodAdjustment enum for this parameter. The default value is |
|
string |
optional |
The type of the period to create. Use a value from the query.PeriodType enum for this parameter. The default value is |
Errors
Error Code |
Thrown If |
---|---|
|
The specified period adjustment is not a value from the query.PeriodAdjustment enum. |
|
The specified period code is not a value from the query.PeriodCode enum. |
|
The specified period type is not a value from the query.PeriodType enum. |
|
Any of the parameters is not a string. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/query Module Script Samples.
// Add additional code
...
var myPeriod = query.createPeriod({
code: query.PeriodCode.LAST_PERIOD,
adjustment: query.PeriodAdjustment.ALL,
type: query.PeriodType.END
});
// myQuery is an existing query.Query object
var myComplexCondition = myQuery.createCondition({
fieldId: 'trandate',
operator: query.Operator.BEFORE,
values: [myPeriod]
});
...
// Add additional code