Remove Hierarchy from Name

The removeHierarchyFromName function effectively simplifies strings by eliminating hierarchical prefixes. It takes a string input, splits it at the colon, and returns the last segment, making it ideal for cleaning up names or titles. The function is wrapped in a try-catch block to handle potential errors gracefully, logging any issues for debugging. This is particularly… Continue reading Remove Hierarchy from Name

Updating Sales Order New Tax Group on Line Level Using Map/Reduce Script

Overview This article provides a step-by-step guide on how to update the tax group on the line level of Sales Orders using a Map/Reduce script in NetSuite. The provided script example demonstrates how to achieve this efficiently by leveraging caching and search functionalities. Script Example /** * @NApiVersion 2.1 * @NScriptType MapReduceScript */ define([‘N/runtime’, ‘N/record’,… Continue reading Updating Sales Order New Tax Group on Line Level Using Map/Reduce Script

Email Recipient Classification in JavaScript

The provided JavaScript function, classifyEmails, efficiently organizes email recipients based on a defined threshold. It takes three arrays as input: recipientArr, ccArr, and bccArr. If the total number of recipients exceeds a specified EMAIL_THRESHOLD, the function splits the recipients into manageable groups. Otherwise, it returns the original recipient array. This approach ensures that email communications… Continue reading Email Recipient Classification in JavaScript

Customizing the Summary Box on Sales Order in NetSuite

Introduction Customizing the summary box on a sales order in NetSuite can enhance the user experience by displaying relevant information in a clear and concise manner. This article explains how to customize the summary box using JavaScript to manipulate the DOM elements. Steps to Customize the Summary Box Access the Totalling Table: let totallingTable =… Continue reading Customizing the Summary Box on Sales Order in NetSuite

Formats an input date string into “DD/MM/YYYY” format using moment.js

  /**          * Formats an ISO date string into “DD/MM/YYYY” format.          *          * @param {string} isoDateStr – The ISO date string to be formatted.          * @returns {string} – The formatted date string in “DD/MM/YYYY” format.        … Continue reading Formats an input date string into “DD/MM/YYYY” format using moment.js

Restrict roles from selecting values from a field by showing alert

function performTradePartnerOrderValidation(currentRec) {             try{         let newsalesOrderType = currentRec.getValue({           fieldId: ‘custbody52’         });         if(salesOrderType == SALES_ORDER_TYE_OBJECT.TRADE_PARTNER_ORDER && salesOrderType != newsalesOrderType && mode == ‘edit’ && !Object.values(TRADE_PARTNER_ORDER_LOCK).includes(role)) {           alert(“You cannot change the trade partner order. Please contact Administrator for details.”);           currentRec.setValue({             fieldId: ‘custbody52’,             value: salesOrderType           });           return false;         }         return true       }       catch(err) {         console.error(‘error@performTradePartnerOrderValidation’, err)       }… Continue reading Restrict roles from selecting values from a field by showing alert

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