Custom Screen Using Custom Record

This is a quick and easy method to create custom screens and fields using the custom record which can replace custom Suitelets for simple custom screen development. Here is an example. To create a custom email window and track the usage we created a custom record and configured fields accordingly. Workflows are implemented to support… Continue reading Custom Screen Using Custom Record

Open Email Message Popup Window using a custom button and set default values

The following User Event Script deployed to Sales Order record places a button on the sales order page named Email CS. Once this button is clicked, an email message window popup will be opened with predefined values of recipient and template category. We could pass many field values through the URL parameters. For those values… Continue reading Open Email Message Popup Window using a custom button and set default values

Generate Transaction PDF using Render

var poPDF = render.transaction({ entityId: recId, printMode: render.PrintMode.PDF }); poPDF.folder= folderID; var fileId = poPDF.save(); The above is a sample function to generate the PDF of any transaction. This code will generate a PDF based on the form selected in the transaction and it can be saved to the desired folder.

Reallocate Items using SuiteScript

Reallocate committed items from Sales Order using SuiteScript. Please Note: NetSuite SuiteAnswer says scripting is not supported for Reallocate Items record, but this is possible via Suitescript. So this might become available in future NetSuite releases as a new feature. So I advise everyone to use this with precaution for now.

Issue in iterating search results

Scenario: While creating saved searches, after getting its result we may need to iterate the result sometimes after the iteration only one item may show in the console(or any output platform). Solution: The searchResults.run() method need a return true statement to continue the iteration. In Suite script, there is no break statement to break the… Continue reading Issue in iterating search results

Auto journal creation & application in Payment

Scenario: Create a journal for applying in the credit section of the payment. Ultimate need is to capture the credit info from the custom record, need to create a journal or custom transaction of journal type then apply the same in the payment record.We have seen a limitation of once payment is saved the credit… Continue reading Auto journal creation & application in Payment

Comparing Two dates

Scenario: We have a start date and a Due date and need to a validation where Due date date should be a date after the Start date. Solution: Usually we can use the JavaScript Date() function. But you can’t compare two dates using that. Better approach to make comparison between dates is to use getTime() function. This… Continue reading Comparing Two dates

Script to get the preferred bin and set to a custom column

This script reads and sets the preferred bin to custom column Bin# for the deployed transactions /** *@NApiVersion 2.1 *@NScriptType UserEventScript */ /*** * FLTW-68 Bin Population script Optimization */ define([‘N/record’, ‘N/search’], function (record, search) { function afterSubmit(context) { try { if (context.type !== context.UserEventType.CREATE && context.type !== context.UserEventType.EDIT) // works for create and edit… Continue reading Script to get the preferred bin and set to a custom column

Read value from a JSON Array by referring to another Key’s value JavaScript

Suppose we have an JSON array as below. var details = [ {“name”:x,”email”:”test@gmail.com}, {“name”:y,”email”:”test1@gmail.com}, ] To get Y’s email id use the below function function findElement(arrayName, nameValue) { for (var i = 0; i < arr.length; i++) if (arr[i][“name”] == propValue) return arr[i][“email”]; // will return undefined if not found; you could return a default… Continue reading Read value from a JSON Array by referring to another Key’s value JavaScript