CodeMoto
CodeMoto

Reputation: 353

NetSuite Suitescript Search Access the Value

I cannot for the life of me get the returned value from a search in NetSuite. When I use the debugger I can see the value, but I cannot access it.

var columns = new nlobjSearchColumn('custentity_employeenumber', null, 'max');
var results = new nlapiSearchRecord('employee', null, filters, columns);
var result = results[0].getValue('custentity_employeenumber');

Every time the debugger shows the result variable as null...I don't get it. I can see the value in the debugger...

enter image description here

I really just need the 2014103...or am I building the search wrong?

Upvotes: 1

Views: 2107

Answers (1)

erictgrubaugh
erictgrubaugh

Reputation: 8902

When you put a summary on a search column, you must specify the summary when you retrieve the value as well. So, because you have:

new nlobjSearchColumn('custentity_employeenumber', null, 'max');

you must retrieve the value with:

results[0].getValue('custentity_employeenumber', null, 'max');

Upvotes: 6

Related Questions