Format Numbers in Indian Numbering System

function formatIndianNumber(amount) {         let formatted ;         // Parse the number to two decimal places         if(amount){          formatted = parseFloat(amount).toLocaleString(‘en-IN’, {             minimumFractionDigits: 2,             maximumFractionDigits: 2        … Continue reading Format Numbers in Indian Numbering System

Preventing Value Entry in a Client Script for NetSuite Sublist Fields

In SuiteScript 2.0, client scripts offer flexibility in managing sublist fields, including restricting or removing values based on specific conditions. The following code snippet demonstrates how to prevent data entry in the Sublist field by clearing any entered value if the row index is even. In this scenario, if a user attempts to enter a… Continue reading Preventing Value Entry in a Client Script for NetSuite Sublist Fields

Sample code Vendor Subsidiary Update using copy Record

/**  * @NApiVersion 2.1  * @NScriptType MapReduceScript  */ define([‘N/record’, ‘N/search’, ‘N/log’], (record, search, log) =>{     /**      * Retrieves all vendor records in old subsidiaries.      * This function is part of the input stage and is used to return the vendor records that meet specific criteria.      *  … Continue reading Sample code Vendor Subsidiary Update using copy Record

Working with Records in SuiteScript: Standard vs. Dynamic Mode

When creating, copying, loading, or transforming records in SuiteScript, developers can choose between standard and dynamic modes. Each mode has unique behaviors regarding how record fields and sublist items are handled. Standard Mode In SuiteScript 2.x, if a script operates in standard mode, the record’s body fields and sublist items are only sourced, calculated, and… Continue reading Working with Records in SuiteScript: Standard vs. Dynamic Mode

Naming a Custom Module

You can assign a custom module name to facilitate reuse. Once configured, the module can be required without specifying the full path. Naming modules also improves compatibility with third-party libraries and helps prevent naming conflicts. To do this, use `define(id, [dependencies,] moduleObject)` and set up a `require` function accordingly. Create your custom module file and… Continue reading Naming a Custom Module

Create a Custom Transaction Body Field to capture the foreign exchange rate on the Invoice.

Adding a Custom Transaction Body Field to Capture the Foreign Exchange Rate on an Invoice: 1. Create a Custom Field:   – First, create a custom field (e.g., `custbody6`, which is the internal ID of the custom field).    2. Display Field:   – Ensure that the field is displayed in the ‘CUSTOM’ tab. 3. Create a… Continue reading Create a Custom Transaction Body Field to capture the foreign exchange rate on the Invoice.

Client Script to Validate Item Type Before Adding to Item Sublist

/**  * @NApiVersion 2.0  * @NScriptType ClientScript  * @NModuleScope SameAccount  */ define([‘N/currentRecord’, ‘N/record’],  /**  * @param {currentRecord} currentRecord  * @param {record} record  */ function (currentRecord, record) { /** * Validation function to be executed when sublist line is committed. * * @param {Object} scriptContext * @param {Record} scriptContext.currentRecord – Current form record * @param {string}… Continue reading Client Script to Validate Item Type Before Adding to Item Sublist

Client Script for Extracting Values from URL

function setContactForm(type) { try { // Corrected typo in variable name ‘typee’ to ‘type’ if (type === ‘create’) { var form = nlapiGetFieldValue(‘customform’); // Renamed GetUrlValue to match the actual function name getQueryVariable var recordType = getQueryVariable(‘parentType’); // If the form is already the desired one, stop the script if (form == 178 && recordType… Continue reading Client Script for Extracting Values from URL

Trigger Client Scripts from a Workflow

Client script functions can be triggered by any Workflow Action scripts that support client-based events (e.g., Before User Edit, After Field Edit, etc.). These functions should be placed in the Custom Formula section of the workflow action. Here’s an example that demonstrates this process. It requires basic knowledge of SuiteScript and Workflows. Solution: 1. Create… Continue reading Trigger Client Scripts from a Workflow