Monday, April 15, 2019

Grouping Results of a Scripted Record Search is resulting to an Unexpected Error


Users may encounter an unexpected error when grouping results of a scripted record search. When applying grouping to a result of a scripted search, all columns need to have summary function otherwise it is treated as an invalid search and adding groupings/summary to the rest of the columns will resolve the unexpected error.

// Sample with error

var col = new Array();
col[0] = new nlobjSearchColumn('custrecord_grade',null,'group');
col[1] = new nlobjSearchColumn('custrecord_employee');
var cust = nlapiSearchRecord('customrecord24', null, null, col);

// Sample code after fixing the above issues
var col = new Array();
col[0] = new nlobjSearchColumn('custrecord_grade',null,'group');
col[1] = new nlobjSearchColumn('custrecord_employee',null,'group');
var cust = nlapiSearchRecord('customrecord24', null, null, col);

No comments:

Post a Comment