Charan
11/15/2024, 10:49 AMCeligo AI
11/15/2024, 10:49 AMAI generated answer (using internal Slack threads):Based on the conversations, here is a sample snippet to create a vendor record and set the address book using SuiteScript 2.1:
javascript
var record = require('N/record');
var vendor = record.create({
type: record.Type.VENDOR,
isDynamic: true
});
vendor.setValue({
fieldId: 'companyname',
value: 'Vendor Name'
});
vendor.setValue({
fieldId: 'subsidiary',
value: '1'
});
var addressSubrecord = vendor.getSubrecord({
fieldId: 'addressbook'
});
addressSubrecord.setValue({
fieldId: 'defaultbilling',
value: 'T'
});
addressSubrecord.setValue({
fieldId: 'defaultshipping',
value: 'T'
});
addressSubrecord.setValue({
fieldId: 'country',
value: 'US'
});
addressSubrecord.setValue({
fieldId: 'addressee',
value: 'Vendor Name'
});
addressSubrecord.setValue({
fieldId: 'addr1',
value: '123 Main St'
});
addressSubrecord.setValue({
fieldId: 'city',
value: 'Anytown'
});
addressSubrecord.setValue({
fieldId: 'state',
value: 'CA'
});
addressSubrecord.setValue({
fieldId: 'zip',
value: '12345'
});
var vendorId = vendor.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
This script creates a new vendor record, sets the company name and subsidiary, and then creates an address subrecord. The address subrecord is set as the default billing and shipping address, and the address details are filled in.
******
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
11/15/2024, 10:49 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846094847
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841276228
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841112077
Celigo AI
11/15/2024, 10:49 AM