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.
Difficulty adding new address
Hi, everyone. Hopefully this is a simple fix that I'm just not seeing.
I am trying to set up a client script on customers such that when you create a new customer and select a parent, the parent's default billing address is automatically copied to this new customer. Here's my code:
var parent = nlapiLoadRecord("customer", nlapiGetFieldValue("parent") ); for( var i = 1, lineCount = parent.getLineItemCount("addressbook") ; i <= lineCount ; i++ ) { if( parent.getLineItemValue("addressbook", "defaultbilling", i) == "T" ) { nlapiSelectNewLineItem("addressbook"); nlapiSetCurrentLineItemValue("addressbook", "defaultbilling", "T"); nlapiSetCurrentLineItemValue("addressbook", "attention", parent.getLineItemValue("addressbook", "attention", i)); nlapiSetCurrentLineItemValue("addressbook", "addressee", parent.getLineItemValue("addressbook", "addressee", i)); nlapiSetCurrentLineItemValue("addressbook", "phone", parent.getLineItemValue("addressbook", "phone", i)); nlapiSetCurrentLineItemValue("addressbook", "zip", parent.getLineItemValue("addressbook", "zip", i)); try { nlapiSetCurrentLineItemValue("addressbook", "addr1", parent.getLineItemValue("addressbook", "addr1", i)); } catch (e) {}; nlapiSetCurrentLineItemValue("addressbook", "addr2", parent.getLineItemValue("addressbook", "addr2", i)); nlapiSetCurrentLineItemValue("addressbook", "city", parent.getLineItemValue("addressbook", "city", i)); nlapiSetCurrentLineItemValue("addressbook", "state", parent.getLineItemValue("addressbook", "state", i)); nlapiSetCurrentLineItemValue("addressbook", "country", parent.getLineItemValue("addressbook", "country", i)); nlapiCommitLineItem("addressbook"); } } 0