Line level shipping custom address --- Has anyone ...
# suitescript
s
Line level shipping custom address --- Has anyone ever set the address by script and used a custom address? it seems like NetSuite want you to select an address that already exists rather than using custom based on references i’m seeing. I did a little testing and failed but not sure if it’s dev or NetSuite problem 🙂
e
I've never set a custom address on the line, only on the header but it shouldn't be any different from adding a custom address to the custom transaction address book which is a subrecord on the transaction.
s
Thanks! I thought so too but it didn’t seem to work… I’m going to retry again just to make sure i didn’t do a stupid typo or something but just wanted to see if i was fighting a loosing battle 😂
b
what does your code look like
s
we went another route for a minute so i removed it… i’ll re-create it and post back here.
simply loading the sublist subrecord throws an unexpected error.
Copy code
var LN_ADDR = REC.getSublistSubrecord('item','shippingaddress',i);
i’ve also noticed that these transactions have a couple new sublists. one is the customer addressbook and one is the shipments because they break the lines into shipments for each address.
b
the other sublists are for the ship groups, you will worry about those later
the line you shared so far looks reasonable, it would be a part of a working solution
more code needed
s
i get that it’s not complete but this is where it fails so if i can’t load the address subrecord then i can’t set anything.
b
you can also make working code with that line you shared
so without the rest i cant give advice
e
shouldn't that be var LN_ADDR = REC.getSublistSubrecord('item','addressbook',i);
s
yeah so i tried that too. no error but nothing happens. tried with or without the -2 value… the reason i was using shipping address is because that does appear to be the list field id
Copy code
// just setting a fixed value for now
REC.setValue('ismultishipto',true);
for(var i = 0; i < REC.getLineCount('item'); i++){
// REC.setSublistValue('item','shippingaddress',i,'-2');
var LN_ADDR = REC.getSublistSubrecord('item','addressbook',i);
LN_ADDR.setValue('addr1','TEST ADDRESS');
}
b
that should probably throw an error
i dont think any record has an addressbook subrecord on the item sublist