Address
The address subrecord is defined in the Common XSD.
For information about address form customization, see Customizing Address Forms.
Operations Must Be in Parent Context
Any add, get, update, delete, or search operation on an address subrecord must be performed within the context of an operation on its parent record. For example, if you want to add address data for a customer, you must update the customer record itself. You cannot do an independent update of the address object. This same limitation applies to all operations on an address subrecord.
Field Definitions
The SOAP Schema Browser includes definitions for all body fields, sublist fields, search filters, and search joins available to this subrecord. For details, see the SOAP Schema Browser’s address reference page.
For information on using the SOAP Schema Browser, see SOAP Schema Browser.
Usage Notes
Address Preferences
The following preferences apply to the address subrecord, and generally to all subrecords:
-
For an add operation, you can put the subrecord in the nullFieldList to null out the subrecord.
-
If a subrecord is not in the nullFieldList, its replaceAll attribute determines whether the subrecord is added or updated during an add operation on its parent record. If this attribute is set to true, the subrecord is deleted and a new one is added. If this preference is set to false, an update of the subrecord is attempted.
Sample Code
The following sections show examples of how to interact with the address subrecord.
Adding a New Record with the Address Specified
The following example illustrates adding a new record with the billing and shipping addresses specified.
SOAP Request
<soapenv:Body>
<add xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<record xsi:type="ns6:Customer" xmlns:ns6="urn:relationships_2017_1.lists.webservices.netsuite.com">
<ns6:isPerson xsi:type="xsd:boolean">true</ns6:isPerson>
<ns6:firstName xsi:type="xsd:string">Maria</ns6:firstName>
<ns6:lastName xsi:type="xsd:string">Magnusson</ns6:lastName>
<ns6:subsidiary internalId="3" xsi:type="ns7:RecordRef" xmlns:ns7="urn:core_2017_1.platform.webservices.netsuite.com"/>
<ns6:addressbookList replaceAll="false" xsi:type="ns6:CustomerAddressbookList">
<ns6:addressbook xsi:type="ns6:CustomerAddressbook">
<ns6:label xsi:type="xsd:string">Billing address</ns6:label>
<ns6:defaultShipping xsi:type="xsd:boolean">false</ns6:defaultShipping>
<ns6:addressbookAddress xsi:type="ns8:Address" xmlns:ns8="urn:common_2017_1.platform.webservices.netsuite.com">
<ns8:country xsi:type="ns9:Country" xmlns:ns9="urn:types.common_2017_1.platform.webservices.netsuite.com">_unitedStates</ns8:country>
<ns8:addressee xsi:type="xsd:string">Maria Magnusson</ns8:addressee>
<ns8:addr1 xsi:type="xsd:string">Hill Crescent 254</ns8:addr1>
<ns8:city xsi:type="xsd:string">Beverly Hills</ns8:city>
<ns8:state xsi:type="xsd:string">CA</ns8:state>
<ns8:zip xsi:type="xsd:string">90210</ns8:zip>
</ns6:addressbookAddress>
</ns6:addressbook>
<ns6:addressbook xsi:type="ns6:CustomerAddressbook">
<ns6:label xsi:type="xsd:string">Shipping address</ns6:label>
<ns6:defaultShipping xsi:type="xsd:boolean">true</ns6:defaultShipping>
<ns6:addressbookAddress xsi:type="ns10:Address" xmlns:ns10="urn:common_2017_1.platform.webservices.netsuite.com">
<ns10:country xsi:type="ns11:Country" xmlns:ns11="urn:types.common_2017_1.platform.webservices.netsuite.com">_unitedStates</ns10:country>
<ns10:addressee xsi:type="xsd:string">Maria Magnusson</ns10:addressee>
<ns10:addr1 xsi:type="xsd:string">Broadway 75</ns10:addr1>
<ns10:city xsi:type="xsd:string">New York City</ns10:city>
<ns10:state xsi:type="xsd:string">NY</ns10:state>
<ns10:zip xsi:type="xsd:string">10005</ns10:zip>
</ns6:addressbookAddress>
</ns6:addressbook>
</ns6:addressbookList>
</record>
</add>
</soapenv:Body>
SOAP Response
<soapenv:Body>
<addResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<writeResponse>
<platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
<baseRef internalId="630" type="customer" xsi:type="platformCore:RecordRef" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
</writeResponse>
</addResponse>
</soapenv:Body>
Updating a Record with a New Address
In this example, a customer’s address is replaced with a new address. To update an address, you have to use a keyed sublist. For information about working with keyed sublists, see Updating Sublists in SOAP Web Services.
SOAP Request
<soapenv:Body>
<update xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<record internalId="831" xsi:type="ns6:Customer" xmlns:ns6="urn:relationships_2017_1.lists.webservices.netsuite.com">
<ns6:addressbookList replaceAll="true" xsi:type="ns6:CustomerAddressbookList">
<ns6:addressbook xsi:type="ns6:CustomerAddressbook">
<ns6:defaultShipping xsi:type="xsd:boolean">true</ns6:defaultShipping>
<ns6:defaultBilling xsi:type="xsd:boolean">true</ns6:defaultBilling>
<ns6:label xsi:type="xsd:string">Main address</ns6:label>
<ns6:addressbookAddress xsi:type="ns7:Address" xmlns:ns7="urn:common_2017_1.platform.webservices.netsuite.com">
<ns7:country xsi:type="ns8:Country" xmlns:ns8="urn:types.common_2017_1.platform.webservices.netsuite.com">_unitedStates</ns7:country>
<ns7:addressee xsi:type="xsd:string">Harriet Thomas</ns7:addressee>
<ns7:addr1 xsi:type="xsd:string">Broadway 65</ns7:addr1>
<ns7:city xsi:type="xsd:string">New York</ns7:city>
<ns7:zip xsi:type="xsd:string">10008</ns7:zip>
</ns6:addressbookAddress>
</ns6:addressbook>
</ns6:addressbookList>
</record>
</update>
</soapenv:Body>
SOAP Response
<soapenv:Body>
<updateResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<writeResponse>
<platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
<baseRef internalId="831" type="customer" xsi:type="platformCore:RecordRef" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
</writeResponse>
</updateResponse>
</soapenv:Body>
Searching for Addresses
The following example illustrates how to search for the address details of records. In this example, a city is specified as the search term. The response lists all records with the specified city in the address.
SOAP Request
<soapenv:Body>
<search xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<searchRecord xsi:type="ns6:AddressSearchBasic" xmlns:ns6="urn:common_2017_1.platform.webservices.netsuite.com">
<ns6:city operator="is" xsi:type="ns7:SearchStringField" xmlns:ns7="urn:core_2017_1.platform.webservices.netsuite.com">
<ns7:searchValue xsi:type="xsd:string">Edinburgh</ns7:searchValue>
</ns6:city>
</searchRecord>
</search>
</soapenv:Body>
SOAP Response
<soapenv:Body>
<searchResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<platformCore:searchResult xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
<platformCore:status isSuccess="true"/>
<platformCore:totalRecords>1</platformCore:totalRecords>
<platformCore:pageSize>1000</platformCore:pageSize>
<platformCore:totalPages>1</platformCore:totalPages>
<platformCore:pageIndex>1</platformCore:pageIndex>
<platformCore:searchId>WEBSERVICES_3604360_1030201718380211442049908681_fb97b2958d9</platformCore:searchId>
<platformCore:recordList>
<platformCore:record xsi:type="platformCommon:Address" xmlns:platformCommon="urn:common_2017_1.platform.webservices.netsuite.com">
<platformCommon:internalId>306</platformCommon:internalId>
<platformCommon:country>_unitedKingdomGB</platformCommon:country>
<platformCommon:addressee>Hella Bigsmile</platformCommon:addressee>
<platformCommon:addr1>Montgomery Street 5</platformCommon:addr1>
<platformCommon:city>Edinburgh</platformCommon:city>
<platformCommon:state>E Lothian</platformCommon:state>
<platformCommon:addrText>Hella Bigsmile<br>Montgomery Street 5<br>Edinburgh<br>E Lothian<br>United Kingdom</platformCommon:addrText>
<platformCommon:override>false</platformCommon:override>
</platformCore:record>
</platformCore:recordList>
</platformCore:searchResult>
</searchResponse>
</soapenv:Body>