Why can’t I get shipaddr1 from a sales order recor...
# suitescript
z
Why can’t I get shipaddr1 from a sales order record?
e
Show us your code
z
Untitled
shipcity works and I see all three in the xml, but the first two return null
e
Copy code
var rec = record.load({
                type: record.Type.SALES_ORDER,
                id: recid,
                isDynamic: true
            });

var subrec = rec.getSubrecord({
    fieldId: 'shippingaddress'
  });    

 payload.shipTo.address1 = subrec.getValue({
    fieldId: 'shipaddr1'
  });

payload.shipTo.address2 = subrec.getValue({
    fieldId: 'shipaddr2'
  });
Try this
I think 'shipcity' is considered a transaction field, where the others are subrecord fields.
z
Okay, kinda weird that it lets you see them in the xml. I will just access them in the subrec then
@blackTshirt What is the proper field ID for getSubrecord for the shipping address?
e
I thought it was 'shippingaddress'
z
Oh yep, thank you! I spelled it wrong. haha
s
I think using the subrecord is the 'official' way