We have created profit and loss report in the form of saved search.
so now we are having account and the corresponding values in saved search. values in saved search are as a result of formula fields.
below is an example.
one of the column 'purchases' has been defined as formula field of currency type with below formula having summary type as 'sum' and custom label and summary label as purchases.
case when {accounttype} = 'Cost of Goods Sold' then {grossamount} else 0 end
now when i am executing this saved search from suite script i am getting null value for the purchase column. however i am able to get value for account column.
below is my code for executing saved search.
var account = new nlobjSearchColumn('account',null,'group');
var purchases = new nlobjSearchColumn('formulacurrency',null,'sum');
purchases.setFormula("case when {accounttype} = 'Cost of Goods Sold' then {grossamount} else 0 end");
var columns = [account, purchases];
var m = nlapiSearchRecord(null,'customsearch648',null,columns);
if(i != m.length)
{
str = str + m[i-1].getText('account',null,'group') + "," + m[i-1].getValue('purchases',null,'sum') + String.fromCharCode(13);
}
any idea what i am doing wrong.