How to apply a credit memo on an invoice through Suitescript

We can apply a credit memo on a specified invoice through Suitescript: 1.0 // …existing code… //Load Credit Memo var creditMemoRecord = nlapiLoadRecord(‘creditmemo’, creditMemoID); //Get line number with invoice where you want apply var invoiceLineIndex = creditMemoRecord.findLineItemValue(‘apply’, ‘internalid’, InvoiceIdToApplyMemo); if (invoiceLineIndex !== -1) {     //Get Total amount of invoice     var invoiceTotal… Continue reading How to apply a credit memo on an invoice through Suitescript

Function to format date (instead of using format or moment.js) Suitescript 1.0

unction formatNSDate(fld, datePassed) {    try {        dLog(‘datePassed : ‘ + fld + ‘ =’, datePassed);                  var monthMap = {            ‘jan’: ’01’, ‘feb’: ’02’, ‘mar’: ’03’, ‘apr’: ’04’,            ‘may’: ’05’, ‘jun’: ’06’, ‘jul’: ’07’, ‘aug’: ’08’,            ‘sep’: ’09’, ‘oct’: ’10’, ‘nov’: ’11’, ‘dec’: ’12’        };          // Get date format from user preference        var dateFormat;… Continue reading Function to format date (instead of using format or moment.js) Suitescript 1.0

Not updating a line when the value of Qtypickpackship field is not empty.

In the for loop, just get the value of the field and check if it is empty or not and continue if it is not empty. for (j=1; j<=lineCnt; j++) {                     var qtyPickPackShip = recSO.getLineItemValue(‘item’, ‘quantitypickpackship’, j);                … Continue reading Not updating a line when the value of Qtypickpackship field is not empty.

Determine if Users’s Netsuite Account is a OneWorld/Non-OneWord Account by SuiteScript

Scenario  User would like to determine if NetSuite account is One-World by using SuiteScript Solution A unique identifier of a OneWorld Account is the use of Subsidiaries which are not available otherwise. Below are two other methods to determine whether an account is OneWorld or not via scripting: Server Side Script: var isOneWorld; var companyInfo = nlapiLoadConfiguration(‘userpreferences’); //gets… Continue reading Determine if Users’s Netsuite Account is a OneWorld/Non-OneWord Account by SuiteScript

Call SuiteScript 2. x Scripts from SuiteScript 1.0 Scripts

If converting your SuiteScript 1.0 scripts to SuiteScript 2. x is not feasible in your situation, you can use SuiteScript 2. x to develop any new functionality within a RESTlet and call the RESTlet from your SuiteScript 1.0 script using the nlapiRequestRestlet() function. This approach lets you take advantage of the features, APIs, and functionality… Continue reading Call SuiteScript 2. x Scripts from SuiteScript 1.0 Scripts

How to implement a script library file in NetSuite

We can store global variables and functions inside a script library file in NetSuite. This helps to easily use a function or variable in multiple script records without defining the same for each record. For example, we can store global variables such as email addresses and commonly used functions inside a library file and access… Continue reading How to implement a script library file in NetSuite

How to fix ‘Syntax error: missing ; before statement’ for suitescript documents version 2.0 and below

Suitescripts written in version 2.0 or below shows this error ‘Syntax error: missing ; before statement’ even when there is ‘;’ present after every single line of code. For example check this client script sample code in suitescript v2.0.(This is a sample code and not used for any specific purpose) /** *@NApiVersion 2.0 *@NScriptType ClientScript… Continue reading How to fix ‘Syntax error: missing ; before statement’ for suitescript documents version 2.0 and below