const getParameterByName = (name, url) => { try { if (!url) url = window.location.href; name = name.replace(/[[]]/g, “$&”); let regex = new RegExp(“[?&]” + name + “(=([^&#]*)|&|#|$)”), results = regex .exec(url); if (!results) return null; if (!results[2]) return ‘ ‘; return decodeURIComponent(results[2].replace(/+/g, ” “)); } catch (e) { console.error(“Err@ FN getParameterByName”, e); } } //routeId… Continue reading JavaScript code that generates a passcode by encoding the Base64 of existing parameters from the URL and timestamp. Then, load the URL by adding this generated passcode as an additional parameter using the debug console.
Author: Pranav Prakash
Fix CORS issue while running on localhost.
Add Allow CORS: Access-Control-Allow-Origin Extension in the browser. Activate by clicking on “ON”. Add CORS whitelisted domains in opening the page after clicking here.
Suitescript code to redirect to a new record creation page with current record id as parameter.
every() function in JavaScript
Executes a function for each array element. Returns true if the function returns true for all elements. Returns false if the function returns false for one element. Sample code Here log will be true because every element in the array satisfies the condition. If the value of array is [11,2,4,6,8], the output will be zero… Continue reading every() function in JavaScript
Build a Vue project into a single HTML file.
‘vite-plugin-singlefile’ allows you to inline all JavaScript and CSS resources directly into the final index.html file. To install type this in command prompt Add the given code in vite.config.js Build the app and now a single index.html file will be created.
some() function in Javascript
The some() method is used with arrays. It checks if any array elements pass a test provided as a callback function. Code sample
Add font-awesome cdn to display icons in Vue js
Open index.html file and add given code Sample html code to display a sample icon
Suitelet Script sample that renders an HTML file from the NetSuite File Cabinet:
How to install vue-router in Vue project
Vue Router is the official router for Vue.js. To install Vue Router type this in command prompt. After installing Vue Router, enter the script in main.js file Given is the Javascript sample of Vue Router
Attach files in a record from Base64-encoded string. (Taking pdf file as example)
Consider base64Content as array containing Base64-encoded strings