Google Tracking

Sunday, 25 June 2017

Fetch Country List & Country Code


// Fetch the country list and country code using script
/**
 * @NApiVersion 2.x
 * @NScriptType ScheduledScript
 * @NModuleScope SameAccount
 */
require(['N/record'],
/**
 * @param {record} record
 */
function(record) {
    /**
     * Definition of the Scheduled script trigger point.
     *
     * @param {Object} scriptContext
     * @param {string} scriptContext.type - The context in which the script is executed. It is one of the values from the scriptContext.InvocationType enum.
     * @Since 2015.2
     */
    function execute(scriptContext) {
        var objRecord = record.create({
            type: record.Type.CUSTOMER,
            isDynamic: true,
        });
        var lineNum = objRecord.selectNewLine({
            sublistId: 'addressbook'
        });
        var objSubrecord = objRecord.getCurrentSublistSubrecord({
            sublistId: 'addressbook',
            fieldId: 'addressbookaddress'
        });
        var countryFieldObj = objSubrecord.getField({
            fieldId: 'country'
        });
        var countryOptions = countryFieldObj.getSelectOptions({
            filter : 'C', // Optional
            operator : 'startswith' // Optional
        });
    }
    var callFun = execute();
   /* return {
        execute: execute
    };*/
});

Image Not Found

No comments:

Post a Comment

Fetch Country List & Country Code

// Fetch the country list and country code using script /**  * @NApiVersion 2.x  * @NScriptType ScheduledScript  * @NModuleScope SameA...