Anyone know what this could be? "type": "error.Su...
# suitescript
c
Anyone know what this could be? "type": "error.SuiteScriptError", "name": "FIELD_1_IS_NOT_A_SUBRECORD_FIELD", "message": "Field billingaddress is not a subrecord field.",
Copy code
const billAddress = invoice.getSubrecord({fieldId: 'billingaddress'});
const billCountryCode = billAddress.getValue({fieldId: 'country'});
Seems to work sometimes then not other times.
a
Transactions (Sales Orders) may have two types of billing / shipping addresses: • The one coming from the customer. • One custom added to the transaction at the transaction level (manually). Those two addresses behave in different ways.
c
So it’s a different filed depending where the billing address is coming from?
a
Different way to handle the same field if I remember correctly…
But I also think ship country and bill country may be available at the record level, did you try the record viewer chrome extension?
a
just from memory... and maybe this is for the ship not bill address? I think the subrecord field is
billingaddresslist
?
image.png
yeah so its
billaddress
or
billaddresslist
the
blilingaddress
is the text summary field that just concats all the various address lines into a single text address
c
I don't really understand why this code works on some SO->INV transformed records but not others.
"message": "Field billingaddresslist is not a subrecord field.",
a
🙂
so
billaddress
?
and yeah NS addresses are annoying as hell
c
billaddress - same thing
Again, for some records only
Which is the part I don't understand
a
oh wow ok umm yeah i hate addresses someone is gonna have to help you then 😂
😂 1
e
Any other differences besides the record? e.g. CREATE vs EDIT vs XEDIT?
and is it different record instances or different record types?
c
Instances
they are all invoices transformed from SOs
I haven't look at other types of invoies yet (ones not from SOs)
Some are CREATE, others are EDIT
I think it's the EDIT ones not working from what I can see
I just rewrote this script as a client script and it's much more consistent now. I think there was something specific about EDIT and beforeSubmit() but I don't know what.
🤔 2