KM
07/14/2026, 5:10 PMCeligo AI
07/14/2026, 5:10 PMAI generated answer (using internal Slack threads):To create a customer with an address in SuiteScript, you need to use the
addressbook field of the customer record. This field is a sublist that contains all the addresses for the customer. Each address is represented as a subrecord.
Here is a sample code snippet that demonstrates how to create a customer with an address:
javascript
var customerRecord = record.create({
type: record.Type.CUSTOMER,
isDynamic: true,
});
customerRecord.setValue({
fieldId: 'companyname',
value: 'Test Company'
});
customerRecord.selectNewLine({
sublistId: 'addressbook'
});
var subrecord = customerRecord.getCurrentSublistSubrecord({
sublistId: 'addressbook',
fieldId: 'addressbookaddress'
});
subrecord.setValue({
fieldId: 'addr1',
value: '123 Test St'
});
subrecord.setValue({
fieldId: 'city',
value: 'Test City'
});
subrecord.setValue({
fieldId: 'state',
value: 'TS'
});
subrecord.setValue({
fieldId: 'zip',
value: '12345'
});
customerRecord.setCurrentSublistValue({
sublistId: 'addressbook',
fieldId: 'defaultbilling',
value: true
});
customerRecord.setCurrentSublistValue({
sublistId: 'addressbook',
fieldId: 'defaultshipping',
value: true
});
customerRecord.commitLine({
sublistId: 'addressbook'
});
var customerId = customerRecord.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
This code creates a new customer record, sets the company name, and then adds a new line to the addressbook sublist. It then gets a subrecord for the addressbookaddress field and sets the address details. It also sets the new address as the default billing and shipping address. Finally, it commits the new line to the sublist and saves the customer record.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
07/14/2026, 5:11 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.845825195
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833252
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830200195
Celigo AI
07/14/2026, 5:11 PM