let customerObj = search.lookupFields({ type: search.Type.CUSTOMER, id: customerId, columns: [‘overduebalance’] … Continue reading Overdue Balance of A Customer Using Search Module
Tag: javascript and suitescript
Short Name of the Customer Using User Event Script
Using the below logic we are able to create shortname of the customer in the following format First 2 characters of the customer’s name: date created month (01) /** * @NApiVersion 2.1 * @NScriptType UserEventScript */ define([‘N/record’, ‘N/search’], /** * @param{record} record * @param{search} search */ (record, search) => { … Continue reading Short Name of the Customer Using User Event Script
Mastering SuiteScript: Essential JavaScript Tips and Tricks for Developers
Mastering Suite Script often requires going beyond the basics and leveraging advanced JavaScript techniques to create efficient, maintainable, and robust scripts. In this article, we’ll explore some essential JavaScript tips and tricks that can elevate your SuiteScript development. 1. Use Let and Const Instead of Var In modern JavaScript (ES6 and later), it’s recommended to… Continue reading Mastering SuiteScript: Essential JavaScript Tips and Tricks for Developers
List of Items having Quantity in transit using Search Module
let itemobj = search.create({ type: search.Type.ITEM, filters:[‘internalid’,‘is’,itemid], columns:[‘internalid’,‘quantityintransit’] }); … Continue reading List of Items having Quantity in transit using Search Module
Spread Operator in JavaScript
The spread operator in JavaScript, represented by …, allows an iterable (such as an array or string) to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals)… Continue reading Spread Operator in JavaScript
Counting the Total Number of Days using Script from Business Days
To count the business days backward use a while loop to move one day back and check whether it is a weekend or not using day numbers 0 to 6. Each day of a week start from Sunday that is 0 and ends with Saturday that is 6, use getDay() to get the number of… Continue reading Counting the Total Number of Days using Script from Business Days
Fetch current URL Parameters at Before Load user event in SuiteScript 2.0
The beforeLoad’s entry point gives you an http.ServerRequest via the context.request parameter. function beforeLoad(context) { var parms = context.request.parameters; if(parms) { // do stuff } }
How the let, const, and var Keywords Work in JavaScript
In JavaScript, we can declare variables in three different ways like this: It is best when you understand var, let, and const with these three concepts: Scope Reassigning a new value When you access a variable before declaring it These keywords differ in usage with respect to these concepts. Variable Scope in JavaScript In JavaScript,… Continue reading How the let, const, and var Keywords Work in JavaScript
Serverside promises
Promises are now supported serverside so you can now write asynchronous code. Example You can also create your own Promises now like so: Async functions (Async/Await) Async functions provide a way to structure and simplify your asynchronous code. It is useful to avoid callback that comes with Promises as it can get pretty complex. Example