Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Trying to retrieve addressbook sublist data from transaction form
I have the following script attached to a form (a sales order form).
What I want it to do is look up an addressbook record with a specific label and use that data to populate some custom fields in the sales order.
The script (below) is able to retrieve the customer record (i.e. the value of the custid variable is set) but the alines variable gets set to -1. What am I doing wrong? This customer has many addressbook entries.
var sp_Messages = ''; function sp_so_helper_pageInit(type) { sp_Messages = 'so_helper.js initn'; var custid=nlapiGetFieldValue('entity'); sp_Messages += 'entity is ' + custid + 'n'; var custo=nlapiLoadRecord('customer',custid); var alines=nlapiGetLineItemCount('addressbook'); sp_Messages += 'num address lines ' + alines + 'n'; sp_so_helper_updateScriptMessage(); } function sp_so_helper_getItemCount() { var lineNum = nlapiGetLineItemCount('item'); return lineNum; } function sp_so_helper_updateScriptMessage() { nlapiSetFieldValue('custbody_sp_scriptmessage',sp_Messages); } 0