GET transfer Order API Restlet

/** * @NApiVersion 2.1 * @NScriptType Restlet *//** * APP GET transfer Orders * * Get the Transfer orders * .Inventory Transfer Orders with status “Pending Fulfillment” and sourceLocationId = siteId * .Inventory Transfer Orders with status “Pending Receipt” and destinationLocationId = siteId */define([‘N/search’,’./moment.min.js’,’./hs.2x.logger.js’], /** * @param{search} search */ (search,moment,logger) => { let API =… Continue reading GET transfer Order API Restlet

Sample Restlet

/** * @NApiVersion 2.1 * @NScriptType Restlet */define([“N/record”], (record) => { /** * Defines the function that is executed when a GET request is sent to a RESTlet. * @param {Object} requestParams – Parameters from HTTP request URL; parameters passed as an Object (for all supported * content types) * @returns {string | Object} HTTP… Continue reading Sample Restlet

Purchase order list API using Restlet

/** * @NApiVersion 2.1 * @NScriptType Restlet */define([‘N/search’,’./moment.min.js’,’./hs.2x.logger.js’], /** * @param{search} search */ (search,moment,logger) => { let DEFAULT_PAGE_SIZE = 25 let API = ‘PURCHASEORDER’ /** * Defines the function that is executed when a POST request is sent to a RESTlet. * @param {string | Object} requestBody – The HTTP request body; request body is… Continue reading Purchase order list API using Restlet

Sample – User Event Script

User event script /** * @NApiVersion 2.1 * @NScriptType UserEventScript */ define([‘N/ui/message’,’N/runtime’,’N/email’], (message,runtime,email) => { /** * Defines the function definition that is executed before record is loaded. * @param {Object} scriptContext * @param {Record} scriptContext.newRecord – New record * @param {string} scriptContext.type – Trigger type; use values from the context.UserEventType enum * @param {Form}… Continue reading Sample – User Event Script

Sample Mass update for item fulfilment status

Mass update script /** /** * @NApiVersion 2.1 * @NScriptType MassUpdateScript */ /** * update the status of the itemfulfillment */ define([‘N/runtime’,”N/record”], (runtime,record) => { /** * Defines the Mass Update trigger point. * @param {Object} params * @param {string} params.type – Record type of the record being processed * @param {number} params.id – ID… Continue reading Sample Mass update for item fulfilment status

Map/Reduce script FAILED while triggering from Restlet.

Script let processTask = task.create({ taskType:task.TaskType.MAP_REDUCE, scriptId:’customscript_hms_fix_hospice’, deploymentId:’customdeploy_hms_fix_hospice’, params:{custscript_hms_data_to_be_processed:queRecId} }) try{ let processId = processTask.submit() }catch(err) { if(err.name != “NO_DEPLOYMENTS_AVAILABLE”) { // If error except no deployments availble log.error(“error”,err); throw err; } } getInputData works fine. Map reduce work while clicking on save & Execute Issue: The integration record should have following permissions to access… Continue reading Map/Reduce script FAILED while triggering from Restlet.

Sample Suitelet – User interface Form

/** * @NApiVersion 2.1 * @NScriptType Suitelet */ /** * Simple form with Name field – Say hello */ define([‘N/ui/serverWidget’], /** * @param{serverWidget} serverWidget */ (serverWidget) => { /** * Defines the Suitelet script trigger point. * @param {Object} scriptContext * @param {ServerRequest} scriptContext.request – Incoming request * @param {ServerResponse} scriptContext.response – Suitelet response *… Continue reading Sample Suitelet – User interface Form

SuiteScript’s TimeZone behaviour

-> Netsuite uses PDT timezone for time functions(new Date(),Moment.js etc) in Server side. -> In client scripts it uses the time zone of the User (Browser side) -> In saved search loaded in script it generally shows the time based on the (Company preferences) Related posts https://blog.prolecto.com/2015/01/30/netsuite-server-side-timezone-settings/