---
title: Edit Addresses
slug: netsuite/edit-addresses
description: Learn how to update a customer's address in NetSuite with this comprehensive document. Follow step-by-step instructions and ensure the "replaceAll" parameter is set to false to avoid deleting existing addresses. Explore sample code for adding and updating
docTags: 
createdAt: 2023-10-13T06:39:40.240Z
---

When updating a customer, set replaceAll to false to prevent deleting existing addresses. Also, include the internal ID of the address you want to update. (See [AddressBooks](docId\:LGKOy7mdXhvjzkl2nr9Ql) for all available fields).

```apex
Map<String, Object> nsCustomer = new Map<String, Object>();
nsCustomer.put('internalId', '123');

//  Initialize the Customer Addresses
List<Object> addressBookList = new List<Object>();

// Adding new Address
Map<String, Object> addressBook = new Map<String, Object>();
Map<String, Object> addressbookAddress = new Map<String, Object>();
addressbookAddress.put('addr1','2334 N. Michigan Avenue, Suite 1500');
addressbookAddress.put('city','Chicago');
addressbookAddress.put('state','IL');
addressbookAddress.put('country','_unitedStates');
addressbookAddress.put('zip','60601');

addressBook.put('addressbookAddress',addressbookAddress);
addressBook.put('defaultBilling',true);
addressBook.put('isResidential',true);
addressBook.put('Label','Michigan Avenue');

addressBookList.add(addressBook);

// Updating the existing Address
Map<String, Object> addressBook1 = new Map<String, Object>();
addressBook1.put('internalId','3512');
Map<String, Object> addressbookAddress1 = new Map<String, Object>();
addressbookAddress1.put('addr1','525 S. Lexington Ave');
addressbookAddress1.put('city','Burlington');
addressbookAddress.put('state','NC');
addressbookAddress.put('country','_unitedStates');
addressbookAddress.put('zip','27215');

addressBook1.put('addressbookAddress',addressbookAddress);
addressBook.put('defaultShipping',true);
addressBook1.put('Label','Lexington Ave');

addressBookList.add(addressBook1);

// Adding the Addresses to Customer
Map<String, Object> customerAddressBookList = new Map<String, Object>();
customerAddressBookList .put('addressbook',addressBookList);
customerAddressBookList .put('replaceAll', false); 
nsCustomer.put('addressBookList',customerAddressBookList );

//  Initialize the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('customers', new List<Object>{nsCustomer});
String reqJSON = JSON.serialize(requestJSONMap);

Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'updateCustomer');
reqObj.put('requestJSON', reqJSON);

//  Place a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
```

To find the internal ID of an address, go to the Addresses section of the company record.

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/bgkRIAwL_LXnUIebrdlXn_image.png)

