1.0 to 2.0 script conversion with sample code

This 1.0 code function setCustomerDiscounts(type) {   log.debug(‘setCustomerDiscounts’, ‘==START==’);   try {     if (!isValidForm()) return;     var recType = nlapiGetRecordType();     var recId = nlapiGetRecordId();     var lines = getTransactionLines(recId, recType);     log.audit(‘Doc No’, ‘Doc No ‘ + nlapiGetFieldValue(‘tranid’));     log.debug(‘lines’, JSON.stringify(lines));     if (ObjectUtils.isEmpty(lines)) return;  … Continue reading 1.0 to 2.0 script conversion with sample code

RENDER ADVANCED PDF VIA SUITELET

define([‘N/record’, ‘N/render’, ‘N/search’], (record, render, search) => {     “use strict”;     const TEMPLATE_MAP = {         salesorder: ‘CUSTTMPL_JJ_SO_HIDE_LINE_ITEM_STBUK154’,         estimate: ‘CUSTTMPL_JJ_QUOTE_HIDE_LINE_ITEM_STBUK154’,         invoice: ‘CUSTTMPL_JJ_INV_HIDE_LINE_ITEM_STBUK154’,         itemfulfillment: ‘CUSTTMPL_JJ_IF_HIDE_LINE_ITEM_STBUK154’     };     /**      * Searches and maps SO… Continue reading RENDER ADVANCED PDF VIA SUITELET

CLIENT SCRIPT TO VALIDATE SUITELET PAGES BUTTON ACTION

This code sample is to validate the dates from the sales orders in the suitelet page are changed before save action. if the dates are not changed then alerts the user and restricts save. define([‘N/currentRecord’],     /**      * @param {*} currentRecord      */     (currentRecord) => {      … Continue reading CLIENT SCRIPT TO VALIDATE SUITELET PAGES BUTTON ACTION

SUITE LET SCRIPT TO UPDATE A CUSTOM COL LINE FIELD IN SALES ORDER RECORD

This script is used to get the req del date column in the item line and then using the suitelet fields the sales order lines can be updated fo the mentioned roles define([     ‘N/ui/serverWidget’,     ‘N/record’,     ‘N/runtime’,     ‘N/format’ ],     /**      *      *… Continue reading SUITE LET SCRIPT TO UPDATE A CUSTOM COL LINE FIELD IN SALES ORDER RECORD

To Override the Document numbers

If the document numbers of the transactions need to be set in sequence using a script, then the override checkbox in the setup for automatic document numbering needs to be checked. Navigation –>

Saved Search to get the time bills in ascending order of the date

this code sample will give the time bills search result in the ascending order of the date function timeBillSearchData(subsidiaryDateArr, monthYearComboArr, payrollArray) {             try {                 let subsidiaryArray = subsidiaryDateArr.map(item => item.subsidiary);                 let dateFilters =… Continue reading Saved Search to get the time bills in ascending order of the date

To Get the Runtime Context and set the value of the document number

This code sample will get the run time context and checks if the context is ‘WEBSERVICES’ then fetches the field value of the source and compares if this is equal to ‘web Services’ if the source condition is satisfied then the system fetches the Document number and then suffix it will -WC  const afterSubmit =… Continue reading To Get the Runtime Context and set the value of the document number