Query.condition
The content in this help topic pertains to SuiteScript 2.0.
Property Description |
The simple or nested condition (a query.Condition object) that narrows the query results. The query.Condition object acts in the same capacity as the search.Filter object in the N/search Module. The primary difference is that query.Condition objects can contain other query.Condition objects. To create conditions:
|
Type |
|
Module |
|
Parent Object |
|
Sibling Object Members |
|
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 myFirstCondition = myCustomerQuery.createCondition({ fieldId: 'id', operator: query.Operator.EQUAL, values: 107
}); var mySecondCondition = myCustomerQuery.createCondition({ fieldId: 'id', operator: query.Operator.EQUAL, values: 2647
}); var myThirdCondition = myCustomerQuery.createCondition({ fieldId: 'email', operator: query.Operator.START_WITH_NOT, values: 'foo'
}); myCustomerQuery.condition = myCustomerQuery.and( myThirdCondition, myCustomerQuery.not( myCustomerQuery.or(myFirstCondition, mySecondCondition) )
);
...
// Add additional code