Reputation: 1118
Being relatively new to SuiteScript, are you able to search for multiple types when using search.create()? I know that in the UI this type of search can be created, but did not see any examples in the documentation of such searches, and wanted to double-check of the correct syntax for doing so as well.
var tranSearch = search.create({
type: [
search.Type.PURCHASE_ORDER,
search.Type.VENDOR_BILL,
search.Type.EXPENSE_REPORT
],
filters: [
search.createFilter({
name : 'lastmodifieddate',
operator: search.Operator.AFTER,
values : formattedDate
})
],
columns : [
search.createColumn({name: 'tranid'}),
search.createColumn({name: 'type'}),
search.createColumn({name: 'status'})
]
});
Upvotes: 1
Views: 3179
Reputation: 15367
You would do a search on transactions and specify the types in a filter:
var tranSearch = search.create({
type:'transaction',
filters:[
search.createFilter({
name:'type',
operator:search.Operator.ANYOF,
values:['PurchOrd', 'VendBill', 'ExpRept']}),
search.createFilter({
name : 'lastmodifieddate',
operator: search.Operator.AFTER,
values : formattedDate
})
],
columns:...
});
Note: A relatively easy way to get the enumerations for transaction types is: -
&xml=T
to the urldbstrantype
element. Its value is the value to use in a filterAnother way is to create a saved search in the UI. Save it and then load and parse it in the console.
Upvotes: 3