Yeah the address subrecord.
# suitescript
k
Yeah the address subrecord.
n
Couldn't find in my own scripts but I did find an example from the documentation. See if that helps: /** * @NApiVersion 2.x * @NScriptType UserEventScript */ define([ 'N/record' ], function(record) { function afterSubmit(context) { // Create the record. var rec = record.create({ type: record.Type.EMPLOYEE, isDynamic: true }); // Set the required body fields. rec.setValue({ fieldId: 'firstname', value: 'John' }); rec.setValue({ fieldId: 'lastname', value: 'Smith' }); rec.setValue({ fieldId: 'subsidiary', value: '1' }); // Create a line in the Address sublist. rec.selectNewLine({ sublistId: 'addressbook' }); // Set an optional field on the sublist line. rec.setCurrentSublistValue({ sublistId: 'addressbook', fieldId: 'label', value: 'Primary Address' }); // Create an address subrecord for the line. var subrec = rec.getCurrentSublistSubrecord({ sublistId: 'addressbook', fieldId: 'addressbookaddress' }); // Set body fields on the subrecord. Because the script uses // dynamic mode, you should set the country value first. The country // value determines which address form is to be used, so by setting // this value first, you ensure that the values for the rest // of the form's fields will be set properly. subrec.setValue({ fieldId: 'country', value: 'US' }); subrec.setValue({ fieldId: 'city', value: 'San Mateo' }); subrec.setValue({ fieldId: 'state', value: 'CA' }); subrec.setValue({ fieldId: 'zip', value: '94403' }); subrec.setValue({ fieldId: 'addr1', value: '2955 Campus Drive' }); subrec.setValue({ fieldId: 'addr2', value: 'Suite 100' }); // Save the sublist line. rec.commitLine({ sublistId: 'addressbook' }); // Save the record. try { var recId = rec.save(); log.debug({ title: 'Record created successfully', details: 'Id: ' + recId }); } catch (e) { log.error({ title: e.name, details: e.message }); } } return { afterSubmit: afterSubmit }; });
k
Thanks Nik. Off home now but will use this tomorrow.