Trying to access custom fields that have been put ...
# suitescript
b
Trying to access custom fields that have been put on the custom address fields for a customer, not getting any values though the fields are populated:
Copy code
function beforeSubmit(context) {
			try {

				var recObj = context.newRecord;
				var sublistid = 'addressbook';
				var lines = recObj.getLineCount({sublistId:sublistid});

				for(var line = 0; line < lines; line++) {

					var fulfillFrom = recObj.getSublistValue({
						sublistId: sublistid,
						fieldId: 'custrecord_tmg_fulfill_from',
						line: line
					});
					log.debug({ title: 'fulfill from', details: fulfillFrom });

				}

			} catch (e) {

				log.error('error', e);

			}
        }
s
custom address fields should appear on the related address *subrecord*(s) for the customer
b
yeah, I'm trying to pull in the subrecord now
ah. getSublistSubrecord that's the ticket
s
for me the code above would just be a one liner something like this
Copy code
_.forEach(rec.addressbook, a => log.debug('fulfill from', a.addressbookaddress.custrecord_tmg_fulfill_from)