Reputation: 3
Trying to get Sales order that are maded from SCA (Suite commerce advanced) here is my code.
var type = searchModule.Type.SALES_ORDER;
var columns = [];
var filters = [];
columns = _.concat(columns, [
searchModule.createColumn({
name: 'internalid'
}),
searchModule.createColumn({
name: 'tranid'
})
]);
filters = _.concat(filters, [
searchModule.createFilter({
name: 'status',
operator: searchModule.Operator.IS,
values: 'SalesOrd:A'
}),
searchModule.createFilter({
name: 'mainline',
operator: searchModule.Operator.IS,
values: 'T'
}),
searchModule.createFilter({
name: 'type',
operator: searchModule.Operator.ANYOF,
values: 'SalesOrd'
}),
searchModule.createFilter({
name: 'source',
operator: searchModule.Operator.STARTSWITH,
values: 'Web'
})
]);
var mySearchObj = {type: type, filters: filters, columns: columns};
// uncomment for test use
/*
log.debug({title: 'type', details: type});
log.debug({title: 'columns', details: columns});
log.debug({title: 'filters', details: filters});
*/
var searchItems = searchModule.create(mySearchObj).run().getRange({start: 0, end: 999});
ordersList = [];
the filter that is not working
searchModule.createFilter({
name: 'source',
operator: searchModule.Operator.STARTSWITH,
values: 'Web'
})
its there any way to get this work, i tried with CONTAINS also and the same problem not working. launch and SC exeptions.
Upvotes: 0
Views: 156
Reputation: 128
You should use ANYOF
as operator instead STARTSWITH
searchModule.createFilter({
name: 'source',
operator: searchModule.Operator.ANYOF,
values: ['WebStore Name']
})
Here is an extract of a working saved search with source field used as filter.
{
"name":"source",
"join":null,
"operator":"anyof",
"values":[
"NLWebStore"
],
"formula":null,
"summarytype":null,
"isor":false,
"isnot":false,
"leftparens":0,
"rightparens":0
}
Upvotes: 1
Reputation: 8847
The source
Filter has a Field Type of Select
, which means you cannot use text operators on it. The only operators you can use are ANYOF
and NONEOF
. You will want to find the Internal ID of the SCA value for Source and use that for your Filter value instead.
I'm unsure where that ID can be found, but you can find it by loading a Sales Order that has the appropriate value set in its Source field and using getValue()
to see what that value is.
Upvotes: 1