query.createRelativeDate(options)
Method Description |
Creates a query.RelativeDate object that represents a date relative to the current date. Use this method to create a query.RelativeDate object to use as part of a query condition. After you create a query.RelativeDate object, you can use it directly in the When you call this method, the |
Returns |
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Sibling Module Members |
|
Since |
2019.1 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
string |
required |
The ID of the relative date to create. Use the query.DateId enum to set this value. |
|
number |
required |
The value to use to create the relative date. This value depends on the value that you specify for |
Errors
Error Code |
Thrown If |
---|---|
|
The specified value for |
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 myTransactionQuery = query.create({
type: query.Type.TRANSACTION
});
var myRelativeDate = query.createRelativeDate({
dateId: query.DateId.DAYS_AGO,
value: 5
});
myTransactionQuery.condition = myTransactionQuery.createCondition({
fieldId: 'trandate',
operator: query.Operator.WITHIN,
values: [query.RelativeDateRange.THREE_FISCAL_YEARS_AGO.start, myRelativeDate]
});
...
// Add additional code