hoppiness
hoppiness

Reputation: 43

NetSuite SOAP update to ADD address to address book

I have a customer in NetSuite with 3 shipping addresses in the address book -- 1 default and 2 that are not default.

I want to simply add another (non-default) shipping address using a SOAP update.

When I post the below, not only does it overwrite my first non-default address, it actually deletes the other one.

How can I define this differently so that it simply adds my new address to the customer's address book?

<q1:addressbook>                 
    <q1:defaultShipping>false</q1:defaultShipping>
    <q1:addressbookAddress>                         
                        <addr1 xmlns="urn:common_2016_1.platform.webservices.netsuite.com">new address line</addr1>
                        <addrPhone xmlns="urn:common_2016_1.platform.webservices.netsuite.com">555-555-5555</addrPhone>
                        <city xmlns="urn:common_2016_1.platform.webservices.netsuite.com">New York</city>
                        <country xmlns="urn:common_2016_1.platform.webservices.netsuite.com" internalId="_unitedStates"/>
                        <state xmlns="urn:common_2016_1.platform.webservices.netsuite.com">NY</state>
                        <zip xmlns="urn:common_2016_1.platform.webservices.netsuite.com">10001</zip>
    </q1:addressbookAddress>
</q1:addressbook>

Upvotes: 0

Views: 1078

Answers (1)

bknights
bknights

Reputation: 15367

Each (or most anyway) *List element has a replaceAll attribute. Set that to false and you'll only update or add to the list unless the addressbook has an internalId

e.g. something like:

<q1:addressbookList replaceAll="false">
   <q1.addressbook>...</q1.addressbook>
</q1:addressbookList>

https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2018_1/schema/other/customeraddressbooklist.html?mode=package

Upvotes: 3

Related Questions