I've got a search that runs fine in the UI but bre...
# suitescript
s
I've got a search that runs fine in the UI but breaks (silently) when loaded/returned from MR script. If I load and run the search in
getInputDate()
it returns "An nlobjSearchFilter contains an invalid summary type: fulfillingtransaction: COUNT. Is it expected that some searches are just not compatible with MR scripts?
b
what are the filters and columns?
a
@stalbert Search declaration/definition?
s
It's a predefined search in the UI - I'm just trying to load/return it from
getInputData()
b
share the filters and columns anyways
its possible to make searches in the ui that dont work in script
s
this is what the search exporter generates: var salesorderSearchObj = search.create({ type: "salesorder", filters: [ ["type","anyof","SalesOrd"], "AND", ["status","anyof","SalesOrd:B"], "AND", ["shipmethod","anyof","157972"], "AND", ["mainline","is","T"], "AND", ["class","anyof","2"], "AND", ["shipcountry","anyof","US"], "AND", ["internalidnumber","equalto","13964915"], "AND", ["count(fulfillingtransaction)","equalto","0"] ], columns: [ search.createColumn({name: "trandate", label: "Date"}), search.createColumn({ name: "tranid", sort: search.Sort.ASC, label: "Document Number" }), search.createColumn({name: "entity", label: "Name"}), search.createColumn({name: "amount", label: "Amount"}), search.createColumn({name: "shipcarrier", label: "Shipping Carrier"}), search.createColumn({name: "shipzip", label: "Shipping Zip"}), search.createColumn({name: "custcol_rsm_so_item_weight", label: "Item Weight"}), search.createColumn({name: "shipaddress1", label: "Shipping Address 1"}), search.createColumn({name: "shipaddress2", label: "Shipping Address 2"}) ] }); var searchResultCount = salesorderSearchObj.runPaged().count; log.debug("salesorderSearchObj result count",searchResultCount); salesorderSearchObj.run().each(function(result){ // .run().each has a limit of 4,000 results return true; });
I think the summary criteria is possibly something script can't handle?
b
the ui is more forgiving on summary filters and columns
summary filters require summary columns
in the ui, summary filters without summary columns are ignored
in script, it errors
so if the search is doing exactly what its supposed to do, it doesnt need the summary filter and you should remove it
a
Another thing that will work in a regular search but not in Map Reduce is empty columns, you can create a search with empty columns when you only need ID and get the ID with result.id, however that would error out in a Map Reduce.
s
thanks, good to know guys. I admit I've rarely seen search summary filters used