Node.js code for making a POST API call to NetSuite using OAuth 1.0.

const axios = require(‘axios’); const CryptoJS = require(‘crypto-js’); const ACCOUNT_ID = ”; const ENDPOINT = “; const AUTH = {     consumerKey: ”,     consumerSecret: ”,     token: ”,     tokenSecret: ” }; function generateOAuthHeader(httpMethod, url) {     try {         const nonce = Math.random().toString(36).substring(2);    … Continue reading Node.js code for making a POST API call to NetSuite using OAuth 1.0.

How to Export Formatted Excel Reports Using ExcelJS in JavaScript

This example demonstrates how to generate a styled Excel report using ExcelJS in JavaScript. It includes custom headers, conditional formatting, column alignment, and dynamic column width adjustment. import ExcelJS from ‘exceljs’; import { saveAs } from ‘file-saver’; const downloadReport = async (reportData, options = {}) => {  try {   const {    centerAlignedCols = [‘Quantity’],    rightAlignedCols… Continue reading How to Export Formatted Excel Reports Using ExcelJS in JavaScript

How to persist Pinia variables in vue js

In command prompt enter the command npm i pinia-plugin-persistedstate Add the plugin to pinia import { createPinia } from ‘pinia’ import piniaPluginPersistedstate from ‘pinia-plugin-persistedstate’ const pinia = createPinia() pinia.use(piniaPluginPersistedstate) Add the persist option to the store you want to be persisted: import { defineStore } from ‘pinia’ export const useStore = defineStore(‘store’, { state: ()… Continue reading How to persist Pinia variables in vue js

Add filter to saved search using debug console

In certain scenarios, a large volume of data may need to be passed into search filters—for example, numerous internal IDs or a high number of items in a saved search. In such cases, filters can be added directly through the debug console. require([‘N/search’], function (search) { let filterArray = [];//Array containing filter values.   var… Continue reading Add filter to saved search using debug console

suitescript Replace transaction SKUs without affecting transition total

 const updateTransaction = (transactionId, valueArray) => {             try {                 let transactionRecord = record.load({                     type: RECORD_TYPE[valueArray[0][“Type”]],                     id: transactionId,        … Continue reading suitescript Replace transaction SKUs without affecting transition total

Suitescript code to display search result in debug console

require([‘N/search’], function (search) {     const checkForParameter = (parameter, parameterName) => {         if (parameter !== “” && parameter !== null && parameter !== undefined && parameter !== false && parameter !== “null”             && parameter !== “undefined” && parameter !== ” ” && parameter !==… Continue reading Suitescript code to display search result in debug console

Filtering Out Active Parent Records Using Saved Search

max(formulatext: NS_CONCAT({custrecord_parent_rec_id.isinactive})) doesnotcontain ‘T’ This NetSuite formula retrieves the highest parent record ID while ensuring that the results do not include records where the `isinactive` checkbox is set to `TRUE`. 1. `NS_CONCAT(…)` aggregates multiple parent record IDs into a single text string.  2. `max(formulatext: …)` extracts the highest ID from that concatenated set.  3. `doesnotcontain… Continue reading Filtering Out Active Parent Records Using Saved Search

Styling Console Logs

Provided is a sample code used to style the console logs console.log(‘%cStyled Log’, ‘color: blue; font-size: 20px;’);