A standard or custom record in NetSuite has fields that has standard lists or custom lists which changes based on process. These could be approval process or status changes. All these changes are stored on the system information. In case if we need to find the duration of each status for which they were present… Continue reading Finding the duration of a list field based on system information
Category: SuiteScript Functions
SuiteScript Functions related articles will be posted in this category
Converting credentials to base 64 formats for the API call (Access token retrieval)
The function converts the string combining the username and password to base 64 format and apply in the API call for generating the access token. Sample API request code snippet let accessTokenresponse = https.post({ url: AUTH_URL, headers: { ‘Content-Type’: ‘application/x-www-form-urlencoded’, ‘Authorization’: ‘Basic ‘ + getBasicAuthorisation(credentialFetch), }, body: { ‘grant_type’: ‘client_credentials’, } }); /** * @description… Continue reading Converting credentials to base 64 formats for the API call (Access token retrieval)
Function to get the latest currency exchange rate based on base currency and transaction currency
Function to get the latest currency exchange rate based on base currency and transaction currency
Identification of the production and sandbox accounts for real-time integration
When using real-time APIs (user event scripts), we need to identify the environment as well as the account id so that the data is sent to the correct database. In this case, we can add functionality in the library file or in the code to find the production account, and sandbox accounts and send data… Continue reading Identification of the production and sandbox accounts for real-time integration
Function to create inventory adjustment.
Function to create inventory adjustment
Function used to disable a column in a sublist
Function used to disable a column in a sublist
Data manipulation in records using beforeLoad(context) of User Event Script
Data can be manipulated for records created in beforeLoad user events.That is for example we can set the value of any field in ‘create’ mode of beforeLoad(context) of User Event Script.Data cannot be manipulated for records that are loaded in beforeLoad scripts.If you attempt to update a record loaded in beforeLoad, the logic is ignored.That… Continue reading Data manipulation in records using beforeLoad(context) of User Event Script
Shipping Addressee getValue in Sales order
Scenario The Shipping adressee value is null when getting the field value of the ship addressee in a sales order. var addressee = nlapiGetFieldValue(‘shipaddressee’); Solution The recommended way of getting the ship addressee in the sales order is by accessing the subrecord of shipping address field. nlapiViewSubrecord(‘shippingaddress’) The line above will return the address subrecord which… Continue reading Shipping Addressee getValue in Sales order
Setting Field Values Using the Date JavaScript Object
Scenario A developer uses the JavaScript Object new Date() when setting date field values via SuiteScript and is uncertain of the timezone being used by the API. Solution The date and time that is set to fields accepting new Date() varies depending on the current timezone set on the local computer it is running on. So in order to… Continue reading Setting Field Values Using the Date JavaScript Object
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