query.Condition
Object Description |
A condition that narrows the query results. The To create conditions:
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
Since |
2018.1 |
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 myCustomerQuery = query.create({
type: query.Type.CUSTOMER
});
var mySalesRepJoin = myCustomerQuery.autoJoin({
fieldId: 'salesrep'
});
var myLocationJoin = mySalesRepJoin.autoJoin({
fieldId: 'location'
});
var firstCondition = myCustomerQuery.createCondition({
fieldId: 'id',
operator: query.Operator.EQUAL,
values: 107
});
var secondCondition = myCustomerQuery.createCondition({
fieldId: 'id',
operator: query.Operator.EQUAL,
values: 2647
});
var thirdCondition = mySalesRepJoin.createCondition({
fieldId: 'email',
operator: query.Operator.START_WITH_NOT,
values: 'foo'
});
myCustomerQuery.condition = myCustomerQuery.and(thirdCondition, myCustomerQuery.not(myCustomerQuery.or(firstCondition, secondCondition)));
var resultSet = myCustomerQuery.run();
...
// Add additional code