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

Redirect the search results and drilldown as summary level from an ad-hoc search created with the N/search Module.




/**
 * @NApiVersion 2.x
 * @NScriptType Suitelet
 * @NModuleScope SameAccount
 */
define(['N/redirect', 'N/search'],
/**
 * @param {redirect} redirect
 * @param {search} search
 */
function(redirect, search) {
  
    /**
     * Definition of the Suitelet script trigger point.
     *
     * @param {Object} context
     * @param {ServerRequest} context.request - Encapsulation of the incoming request
     * @param {ServerResponse} context.response - Encapsulation of the Suitelet response
     * @Since 2015.2
     */
    function onRequest(context) {
        var customerSearchObj = search.create({
               type: "customer",
               title:"Scripted Customer Search",
               isPublic: true,
               id:"_scripted_customer_search",
               filters: [],
               columns: [
                  search.createColumn({
                     name: "entityid",
                     summary: "GROUP",
                     sort: search.Sort.ASC
                  }),
                  search.createColumn({
                     name: "isperson",
                     summary: "GROUP"
                  }),
                  search.createColumn({
                     name: "datecreated",
                     summary: "GROUP"
                  }),
                  'title',
                  'salesrep',
                  'entitystatus'
               ]
            });
        redirect.toSearchResult({
            search: customerSearchObj
        });           
    }

    return {
        onRequest: onRequest
    };
   
});



Search Result

Search Summary Result









Fetch Country List & Country Code

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