N/config Module Script Sample

The following script sample demonstrates how to use the features of the N/config module.

Load the Company Information Configuration Page and Set Field Values

The following sample loads the Company Information configuration record. It then sets the values for the Tax ID Number field and the Employer Identification Number field and saves the record.

Note:

This sample script uses the require function so that you can copy it into the SuiteScript Debugger and test it. You must use the define function in an entry point script (the script you attach to a script record and deploy). For more information, see SuiteScript 2.x Script Basics and SuiteScript 2.x Script Types.

Note:

The IDs in this sample are placeholders. Replace the values of the Tax ID Number field and the Employer Identification Number field with valid IDs from your NetSuite account.

            /**
 * @NApiVersion 2.x
 */

require(['N/config'],
    function(config) {
        function setTaxAndEmployerId() {
            var companyInfo = config.load({
                type: config.Type.COMPANY_INFORMATION
            });
            companyInfo.setValue({
                fieldId: 'taxid',
                value: '1122334455'
            });
            companyInfo.setValue({
                fieldId: 'employerid',
                value: '123456789'
            });
            companyInfo.save();
            companyInfo = config.load({
                type: config.Type.COMPANY_INFORMATION
            });
            var taxid = companyInfo.getValue({
                fieldId: 'taxid'
            });
        }
        setTaxAndEmployerId();
    }); 

          

General Notices