Function to fetch the Start time and End time for saved search based on the availability of the processor.

Case: When we schedule a script to run every 6 hours, then it will run at 12 am, 6 am, 12 pm, and 6 pm. when the script runs at 6 am, then we need the data from the time 12 am up to 5.59 am. But in case of priority, the scheduler runs at… Continue reading Function to fetch the Start time and End time for saved search based on the availability of the processor.

Methods to connect a Saved Search in NetSuite to a Suitescript

We can create a saved search inside the suite script and run it using the ‘N/search’ module functions. But there can be instances where the search result should be fetched byrunning an existing saved search present in the NetSuite account. This is when the user wants to update the saved search conditions over time without… Continue reading Methods to connect a Saved Search in NetSuite to a Suitescript

How to remove standard message when a document is about to unloaded?

The onbeforeunload event occurs when a document is about to be unloaded. This event allows you to display a message in a confirmation dialog box to inform the user whether he/she wants to stay or leave the current page. The default message that appears in the confirmation box, is different in different browsers. However, the… Continue reading How to remove standard message when a document is about to unloaded?

Disallow the creation of bill if reference already exists for a vendor through csv imports.

if (scriptContext.type == scriptContext.UserEventType.CREATE), then check whether it is a vendor bill. Get the values of vendor and reference number from the current record. Create search to get the count of reference number which is entered in the vendor bill. Return the count. var searchBillResultCount = vendorbillSearchObj.runPaged().count; return searchBillResultCount; If count is greater than zero,… Continue reading Disallow the creation of bill if reference already exists for a vendor through csv imports.

Map Reduce Script

Map/Reduce script is an alternative to a scheduled script which can handle/process a large amount of data. It is best suited for scenarios where data can be divided into small and independent parts. When the script is executed, a structured framework automatically created enough jobs to process all of these parts. No need to manage… Continue reading Map Reduce Script

Sublist item selection method for items rendered in a custom suitelet page

We can select an item from a sublist using the index. If we use the line index we can use the selectLine() function for this.We can also calculate the index value using the line Id. The line id is usually one value greater than the index value. But this can be different if some items… Continue reading Sublist item selection method for items rendered in a custom suitelet page

Using Suitescript, resolve splitting of single data into multiple columns in csv file when there are comma (,) and quotes (“) included in the data.

Consider the value inside variable data as “30″ PVC, 10-meter pipe”. There is a chance of splitting it into “30″ PVC” in one column and “10-meter pipe” in another column. This issue will still persist even after using JSON.stringify. To resolve this, refer the code below.

Setting group item to item sublist in any record using script.

Example situation: User wants to set item sublist of estimate page by importing item lines from different sales orders. So create a button in estimate page, “Import from sales orders”. By clicking that button will open a suitelet page.In the suitelet page the user can select multiple sales order numbers. Then click on submit button… Continue reading Setting group item to item sublist in any record using script.