Felix Divall
01/17/2023, 1:48 PMconst custRec = record.load({
type: record.Type.CUSTOMER,
id: customer,
isDynamic: true
})
const addressLines = custRec.getLineCount('addressbook')
let freightAccountNo
for (let i = 0; i < addressLines; i++) {
const shipLabel = custRec.getSublistText({ sublistId: 'addressbook', fieldId: 'label', line: i })
if (shipLabel === shipTo) {
const addressSubrecord = custRec.getCurrentSublistSubrecord({ sublistId: 'addressbook', fieldId: 'addressbookaddress' })
freightAccountNo = addressSubrecord.getText({
fieldId: 'custrecord_cb_freight_account_no'
})
}
}
If I change the field id from ‘custrecord_cb_freight_account_no’ to ‘country’ I do get back what I expect.
However, ‘custrecord_cb_freight_account_no’ returns nothing.
Has anyone worked with subrecords before? How can I retrieve the value below? (see pictures)Stuart Anderton
01/17/2023, 2:00 PMFelix Divall
01/17/2023, 2:01 PMFelix Divall
01/17/2023, 2:04 PMShawn Talbert
01/17/2023, 4:19 PMShawn Talbert
01/17/2023, 4:23 PMcustomer.addressbook[0].addressbookaddress.custrecord_cb_freight_account_no