Anyone ever seen this error message? `Error - Type...
# general
b
Anyone ever seen this error message?
Error - TypeError: rawColumns[i].push is not a function
I tried to create a saved search using SuiteScript. Interesting thing is when I try it in console, it did work. But when I copy that exact same code to SL and run it didn't work. Here is full code snippet if that helps you.
Copy code
var transactionSearchObj = search.create({
                        type: "transaction",
                        filters:
                        [
                           ["customersubof","anyof","1483"], 
                           "AND", 
                           ["trandate","onorafter","02/28/2023"], 
                           "AND", 
                           ["mainline","is","T"], 
                           "AND", 
                           ["type","anyof","CustDep","CustInvc","CustCred","CustPymt"]
                        ],
                        columns:
                        [
                           search.createColumn({
                              name: "amount",
                              sort: search.Sort.ASC,
                              label: "Amount"
                           }),
                           search.createColumn({
                              name: "formulanumeric",
                              formula: "5",
                              label: "Formula (Numeric)"
                           })
                        ]
                     });
                     var searchResultCount = transactionSearchObj.runPaged().count;
                     log.debug("transactionSearchObj result count",searchResultCount);
                     transactionSearchObj.run().each(function(result){
                        log.debug('result', result);
                        return true;
                     });
Any help would be appreciated
j
when do you get the error, on the search.create call?
b
no when I run that search @jen
I can see its result count log
If I remove that formulanumeric column it works
j
yeahhhh wondering if it is that
did you create this search in the UI also?
b
yes it works in UI
j
are you using the Chrome Search Export tool?
b
yes
j
what’s the purpose of having a formula just to return
5
?
b
yes just for testing
j
weird
what happens if you try a different formula, like “ROUND({amount})” or something?
b
same
j
can you post your whole script? I can try testing it on my end
Copy code
transactionSearchObj.run().each(function(result){
<--- this is the line that errors?
b
yes
that is whole script
Please try this file
j
I’m trying with one of my own scripts that has a similar search and getting the same error!
wait
I think you can’t just dump
result
into the log like that
that’s actually where it’s failing, is on the log.debug(‘result’, result);
Copy code
transactionSearchObj.run().each(function(result){
                        log.debug('amount', result.getValue(result.columns[0]));
                        log.debug('formula', result.getValue(result.columns[1]));
                        return true;
                     });
this is fine
b
Thank you
I tested on other account and it is working fine with log.debug('result', result)
But my account is not working
your code works fine
Thank you for your help. @jen
e
you can use
result.toJSON()