Tag: Suitescript2.0
How to fetch saved search data with the title
Recently, I worked on a single-page application(SPA) for rendering saved search data from NetSuite. The client wanted to reuse the application for multiple saved searches. So, the app was designed with a search internal ID as a URL parameter and the data was fetched using the ID. However, the client also wanted to show the… Continue reading How to fetch saved search data with the title
Prevent error “You cannot edit the end of group line. You must delete the group.” when setting the Description of Line Items in a Transaction
function userEventBeforeSubmit(type, form, request) { var lineCount = nlapiGetLineItemCount(‘item’); for (var i = 1; i <= lineCount; i++) { if (nlapiGetLineItemValue(‘item’, ‘itemtype’, i) != ‘EndGroup’) { nlapiSetLineItemValue(‘item’, ‘description’, i, ‘Test_Description’); } } }
Call SuiteScript 2. x Scripts from SuiteScript 1.0 Scripts
If converting your SuiteScript 1.0 scripts to SuiteScript 2. x is not feasible in your situation, you can use SuiteScript 2. x to develop any new functionality within a RESTlet and call the RESTlet from your SuiteScript 1.0 script using the nlapiRequestRestlet() function. This approach lets you take advantage of the features, APIs, and functionality… Continue reading Call SuiteScript 2. x Scripts from SuiteScript 1.0 Scripts
Showing Standard NetSuite Messages in the “View” Mode
It is not possible to show any standard NetSuite messages from a Client Script in view mode since the scriptContext.mode parameter of the pageInit(scriptContext) function does not support such a value as view. It is also not possible to achieve this in User Event Script beforeLoad(scriptContext) function as well since the Message.show() method is not supported there. However, in some cases it may be handy to provide users with a… Continue reading Showing Standard NetSuite Messages in the “View” Mode
Features of SuiteScript 2.0 over SuiteScript 1.0
1. Map/Reduce Script Type: Based on the Map/Reduce model, SuiteScript 2.0 introduces a new server-side script type that facilitates a structured framework for server-side scripts that process a large number of records. In SuiteSript 1.0, only 10K units of governance can be executed at a single instance of time as per the default framework. To… Continue reading Features of SuiteScript 2.0 over SuiteScript 1.0
Get the Current Date with Time Zone and Preferred Format Using SuiteScript
The user can use SuiteScript to get the current date or time by using the supplied code. It helps format dates in emails, printed forms, and other editable text.
Create table for email content from array of objects.
Let variable arraOfObjects be an array containing objects. To convert it into table for email use the code below.
Suite script Error SSS_INVALID_API_USAGE
When creating a record through CSV import, an SSS_INVALID_API_USAGE error is encountered. The SSS_INVALID_API_USAGE error appears when a user event script instantiates records by using the newRecord. When the script executes on a record that is being created, and the script attempts to use Record.getText(options) without first using Record.setText(options) for the same field. When the script executes on an existing record or on… Continue reading Suite script Error SSS_INVALID_API_USAGE
VALID_LINE_ITEM_REQD when transform from Sales Order to Item Fulfillment
Jira Code : MICL-358 You must have at least one valid line item for this transaction error will stop us from creating an item fulfillment from a sales order at the stage of record.transform() if we did not specify an inventoryLocation in the defaultValue parameter. Here is a working code which creates an item fulfillment via record.transform().