I have a saved search that pulls sales orders for a specific customer based on their email. In the search, it also returns information about the item on the sales order. It works fine inside of NetSuite, but fails when i call it from a suitelet.
The failure occurs when i specify an item column in my column array. In the code snippet below, you will see the line - "columns[6] = new nlobjSearchColumn('storedescription');".
This causes the following error - "An nlobjSearchColumn contains an invalid column, or is not in proper syntax: storedescription."
I also get this error if i try to access the online price or any price. Is there a problem with my syntax? I can't find any suggestions in the online help.
function getMyOrders(request, response) { var myEmail = request.getParameter("myEmail"); var filters = new Array(); filters[0] = new nlobjSearchFilter('email', null, 'is', myEmail); var columns = new Array(); columns[0] = new nlobjSearchColumn('email'); columns[1] = new nlobjSearchColumn('trandate'); columns[2] = new nlobjSearchColumn('number'); columns[3] = new nlobjSearchColumn('quantity'); columns[4] = new nlobjSearchColumn('pricelevel'); columns[5] = new nlobjSearchColumn('internalid'); columns[6] = new nlobjSearchColumn('storedescription'); // this is the item description var searchResults = nlapiSearchRecord('salesorder', 'customsearch216', filters, columns); nlapiLogExecution('DEBUG', 'searchresults', 'searchresults=' + searchResults); nlapiLogExecution('DEBUG', 'searchresults', 'searchresults.length=' + searchResults.length); var callBackFuncStr = request.getParameter('callback'); var strJson=''; var jsonval =''; for ( var i = 0; searchResults != null && i < searchResults.length; i++ ) { jsonval += '{"email":"' + searchResults[i].getValue(columns[0]) + '","date":"' + searchResults[i].getValue(columns[1]) + '","number":"' + searchResults[i].getValue(columns[2]) + '","quantity":"' + searchResults[i].getValue(columns[3]) + '","pricelevel":"' + searchResults[i].getValue(columns[4]) + '","internalid":"' + searchResults[i].getValue(columns[5]) + '","storedescription":"' + searchResults[i].getValue(columns[6]) + '"}'; } if (searchResults.length > 0) { strJson=callBackFuncStr+'(''+jsonval+'');'; nlapiLogExecution('debug','called', strJson); response.write(strJson); } } Any pointers would be greatly appreciated!Thanks.