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.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Update: Narrative Insights has been restored and is now available.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
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