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
Author: Pranav Prakash
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;’);
Use Ant Design React UI component library in react project
Use the following script sample to use Ant design component import React from ‘react’; import { DatePicker } from ‘antd’; const App = () => { return <DatePicker />; }; export default App;
Install Ant Design UI React Component library using npm
Add the following command to install Ant Design UI React component to a react project npm install antd –save
API call a RESTlet endpoint using SuiteScript 2.0 from a client script
let response = https.post({ url: `/app/site/hosting/restlet.nl?script=${SCRIPT_ID}&deploy=${DEPLOYMNT_ID}`, body: JSON.stringify({}), headers: { ‘Content-Type’: ‘application/json’ } });
Some JavaScript functions that can significantly optimize the primitive approaches programmers might use for certain tasks:
reduce const numbers = [10, 20, 30]; const sum = numbers.reduce((total, num) => total + num, 0); console.log(sum); // 60 fromEntries const obj = { a: 1, b: 2, c: 3 }; const transformed = Object.fromEntries( Object.entries(obj).map(([key, value]) => [key, value * 2]) ); console.log(transformed); // { a: 2, b: 4, c: 6 }… Continue reading Some JavaScript functions that can significantly optimize the primitive approaches programmers might use for certain tasks: