Getting a weird error on a SS2 search. Weird beca...
# suitescript
m
Getting a weird error on a SS2 search. Weird because it's identical to a functioning one I use other than the variable names and that it needs to return 2 columns instead of 1. Summary's are the same, layout, etc. So I'm stumped. The error code is: Wrong parameter type: columns[0] is expected as Column. I'm pushing a string of "fbm" as the itemClassification parameter on this particular one. Which is the same as the working code...
Copy code
function salesCommissionInfoSearch(itemClassification) {
        var salesCommissionMap = {};

        var filteredItemClass = [];
        if(itemClassification == 'fbm') {
            filteredItemClass.push(['isinactive','is','F'])
            filteredItemClass.push('AND')
            filteredItemClass.push(['custrecord_br_commission_item_class', 'anyof', '1']) // 1 is FBM, EDI, WebStore
        }
 var salesCommissionSearch = searchModule.create({
            type: 'customrecord_br_sales_commissions',
            filters: [filteredItemClass],
            columns: [
                [searchModule.createColumn({name: 'custrecord_br_commission_weighted_pct', summary: searchModule.Summary.SUM})],
                [searchModule.createColumn({name: 'custrecord_br_commission_weighted_per', summary: searchModule.Summary.SUM})]
            ]
        });
        salesCommissionSearch.run().each(function(result) {
            var salesCommissionWeightedPct = parseFloat(result.getValue({name: 'custrecord_br_commission_weighted_pct', summary: searchModule.Summary.SUM}));
            var salesCommissionWeightedPerUnit = parseFloat(result.getValue({name: 'custrecord_br_commission_weighted_per', summary: searchModule.Summary.SUM}));
i
I don't think your columns are supposed to be in arrays
Copy code
columns: [
                searchModule.createColumn({name: 'custrecord_br_commission_weighted_pct', summary: searchModule.Summary.SUM}),
                searchModule.createColumn({name: 'custrecord_br_commission_weighted_per', summary: searchModule.Summary.SUM})
            ]
Try that
💯 1
m
That was it. Can't believe I missed that! Thank you!!!!
💯 1
i
Great!