Add the below script tags <script src=”https://unpkg.com/primevue/umd/primevue.min.js”></script> <script src=”https://unpkg.com/@primevue/themes/umd/aura.min.js”></script> Add the necessary primevue component in the script as shown below const app = createApp({ // rest code }) app.use(PrimeVue.Config, { theme: { preset: PrimeVue.Themes.Aura, options: { … Continue reading Use primevue library in single html script that use vue cdn
Author: Pranav Prakash
Suitescript module to access methods that verify object and primitive types
Use the N/util module to manually access methods that verify object and primitive types in a SuiteScript 2.x script. These methods can also be accessed using the global util object. For more information about the global util object. Script sample var records = [“Sales Order”, “Invoice”, “Item Fulfillment”]; util.isArray(records); // returns true var record =… Continue reading Suitescript module to access methods that verify object and primitive types
JavaScript method for invoking interceptable JavaScript object internal methods
The Reflect namespace object contains static methods for invoking interceptable JavaScript object internal methods. Some of the examples are provided below Detecting whether an object contains certain properties const duck = { name: “Maurice”, color: “white”, greeting() { console.log(`My name is ${this.name}`); }, }; Reflect.has(duck, “color”); // true Reflect.has(duck,… Continue reading JavaScript method for invoking interceptable JavaScript object internal methods
HTML code to add toaster
<style> /* Toaster Container */ .toaster { position: fixed; top: 20px; right: 20px; z-index: 9999; } /* Toaster Notification */ .toast { background-color: #333; … Continue reading HTML code to add toaster
Add a PrimeVue library component to an HTML page that uses Vue.js.
Add the script below for using primevue. <script src=”https://unpkg.com/primevue/umd/primevue.min.js”></script> <script src=”https://unpkg.com/@primevue/themes/umd/aura.min.js”></script> const { createApp } = Vue; const app = createApp({ }) app.use(PrimeVue.Config, { theme: { preset: PrimeVue.Themes.Aura, options: { darkModeSelector:… Continue reading Add a PrimeVue library component to an HTML page that uses Vue.js.
Modify a disabled field of a record on the edit page in NetSuite using the browser’s debug
Open Edit page of a NetSuite record Inside the browser console, enter the code provided below. require([‘N/currentRecord’], currentRecord=>window.currentRecord=currentRecord) Afterwards, enter the code provided below let recordObj = currentRecord.get(); recordObj .setValue({fieldId:”id_of_the_field”,value:”required_value”}) The disabled field value will be changed by now. Now click on save
JavaScript code to measure precise timestamps in milliseconds for performance tracking.
const start = performance.now(); // perform some function const end = performance.now(); console.log(`Execution time: ${end – start} ms`);
JavaScript backend code for downloading transaction PDFs as a ZIP file
const buttonAction = async (base64Values) => { //let base64Values be the array of object contain transaction number and base64 value of transaction PDFs const filenameSet = new Set(); base64Values.forEach((data, index) => { const byteCharacters = atob(data.base64Value); const byteNumbers = new Array(byteCharacters.length);… Continue reading JavaScript backend code for downloading transaction PDFs as a ZIP file
SuiteScript 2.0 code snippet to store a transaction PDFs base64 value in cache memory for a fixed duration
// Let recordID be the transaction internal Id const renderToPdf = (recordID) => { try { let returnVal = ”; let singleFileCache = cache.getCache({ name: ‘singleFileCache’, scope: cache.Scope.PRIVATE });… Continue reading SuiteScript 2.0 code snippet to store a transaction PDFs base64 value in cache memory for a fixed duration
Display an HTML page when a Suitelet link is clicked
let filePath = ‘../Views/jj_index.html’ // Path of the HTML file let fileObj = file.load({ id: filePath }); if (fileObj) { let fileContent = fileObj.getContents(); this.scriptContext.response.headers[‘Content-Type’] = ‘text/html’; this.scriptContext.response.write(fileContent); } else { this.scriptContext.response.write(‘HTML file not found’); }