I have a question. I am creating a Sales Order via...
# suitescript
a
I have a question. I am creating a Sales Order via suitescript 2.0, part of a custom integration. The requirement is to add the shipping address provided into the Sales Order, but add it to the Customer addresses (if not there already). So, within the code, I am creating a new ‘addressbook’ sublist record, then getting the ‘addressbookaddress’ subrecord, filing out the subrecord with the provided address, then saving the customer record. But what I need is the new address subrecord id, to save it into the Sales Order. Any idea on how I could get this new address subrecord id?
a
You need to set the new address as the default billing / shipping and then create the SO. Netsuite will select the new default for you
a
hi Andrea, thank you for your answer. But I don’t want to save the new address as default shipping. I just need to add it as an additional address. I just need to get the address subrecord id, once created…
a
Sorry... you said that you need the ID because you need to set the newly created address into the sales order, right? Do you want / need to set it in a custom sales order field or as a standard sales order billing/shipping address?
Because if you need to set it into the order like you mentioned in your first thread my solytion it will work...
a
it is in the standard address field within the SO
but I don’t want to change the customer default address
I need to create the additional address on the customer record, as a subrecord
then get the id and put it in the SO shipto address
b
set the new address on the customer, then load the customer again to get the newly created address's id and use that in your transaction
a
thanks battk, I guess I will have to load the customer, then loop thru the addresses and fine the newly created one… I will try that. I was hoping for a more efficient way to get the id, but maybe it is not possible
b
you wont be able to get the address id of a sub record until it has been saved, primarily because it does not exist until saved.
a
yeah… and you cannot save the subrecord itself, right? only with the main record
b
yes
a
great man, thanks a lot!!