Hi every, i'm trying to get the value either "0" o...
# suitescript
h
Hi every, i'm trying to get the value either "0" or "1" from this search in scripting but it all returns "0" even though on the search results there're "1". Does anyone have any idea? Thanks so much
Copy code
search.createColumn({
                                name: "formulanumeric",
                                summary: "MAX",
                                formula: "CASE WHEN {transaction.custbody_al_final_cost} IN (100,150,200,250) AND {transaction.totalamount} NOT IN (100,150,200,250, 300) THEN 1 ELSE 0 END",
                                label: "1. Should be a TONU?"
                            })

obj._VAL_SHOULD_BE_A_TONU = result.getValue({name: "formulanumeric",
                            summary: "MAX",
                            formula: "CASE WHEN {transaction.custbody_al_final_cost} IN (100,150,200,250) AND {transaction.totalamount} NOT IN (100,150,200,250, 300) THEN 1 ELSE 0 END"
                        });
s
Did you try changing those numbers in the
IN()
to things like
'100'
and
'150'
e
You could use the column index;
result.getValue(mySearchObj.columns[columnIndex])
👍 1
h
@Sandii hm it did nothing to it :
@ehcanadian it seems to work well, thanks 😄