Auto-check “Calculate Tax” based on Subsidiary and Vendor country (US)

function countrySearch(internalId, type) {       try {         let countryValueSearch = search.create({           type: type,           filters: [             [“internalid”, “anyof”, internalId]           ],           columns: [             search.createColumn({ name: “country”, label: “Country” })           ]         });         let searchResult = countryValueSearch.run().getRange({ start: 0, end: 1 });         if (searchResult.length > 0) {           return searchResult[0].getValue({ name: “country” });         }         return null;       } catch (e) {         log.error(“error@countrySearch”,… Continue reading Auto-check “Calculate Tax” based on Subsidiary and Vendor country (US)

Redirecting to a Record from Suitelet on a button Click

To return the new purchase order internal id from your suitelet you will need to write it on the response : response.write(purchaseOrderId); You can catch that value from your client side script :   var response = nlapiRequestURL(url);  // run response validation if (response.getCode() == 200) {  var purchaseOrderId = response.getBody();  }   Then you can redirect to your purchase order… Continue reading Redirecting to a Record from Suitelet on a button Click

Show a Loading Spinner with UI Blur During Long-Running Actions

When performing long-running actions in a NetSuite Suitelet or Client Script — such as generating files, calling APIs, or triggering downloads — it’s good practice to show a loading indicator and block the UI to avoid user interaction. Here’s a reusable snippet that creates a full-screen blur overlay and centered loading GIF (spinner). Why Use… Continue reading Show a Loading Spinner with UI Blur During Long-Running Actions

Enforcing Vendor Selection for A/P Accounts in Journal Entries

Business Scenario When users manually create Journal Entries in NetSuite and select an Accounts Payable (A/P) ledger account, it’s critical to associate the correct Vendor. Failing to do so: Breaks subledger-to-ledger reconciliation, Causes issues with aging reports, And risks compliance with audit standards. To ensure data integrity, a validation was required to block line entries… Continue reading Enforcing Vendor Selection for A/P Accounts in Journal Entries

How to Add a Loading Spinner with Blur Overlay in NetSuite

In NetSuite, when executing a heavy client-side operation (like dynamic record updates), users may experience delays without visual feedback. A great way to improve UX is by showing a loading spinner with a blurred background during processing. This can be done using a simple Client Script. Why Use a Spinner? A spinner provides: Immediate feedback… Continue reading How to Add a Loading Spinner with Blur Overlay in NetSuite

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

Inventory Detail Setting using script

Issue In a vendor return record, a client script is deployed. In the pageInit of the script, the code intended to set the inventory details for the item lines. But when the pageInit was triggered, an error occurred saying selectNewLine is not a function when the script was trying to set the inventory detail. Also,… Continue reading Inventory Detail Setting using script