Create SuiteScript of a saved search to fetch location details by passing an array of location names.

Consider the variable ‘locationArray’ as the array that contains location names. let stringArr = ”; for (let i = 0; locationArray.length > i; i += 1) {     stringArr += i > 0 ? “, ‘” + locationArray[i] + “‘, ‘true'” : “‘” + locationArray[i] + “‘, ‘true'”; };let locationSearchObj = search.create({    … Continue reading Create SuiteScript of a saved search to fetch location details by passing an array of location names.

Extract Search Results via SuiteScript with the Ordering Similar to User Interface

To extract the different Kit/Package Item records using Suite Script with the same order as the one in the User Interface when viewing the record. Define the filters. Define the internal id as one of the results columns. var search = search.create({ type: item, filters:, //define filters here columns: [{ name: internalid, sort: search.Sort.ASC }],… Continue reading Extract Search Results via SuiteScript with the Ordering Similar to User Interface

Search for the Shipping Cost in a Sales Order Using SuiteScript

The Field ID of Shipping Cost in a Sales Order record is “shippingcost”. However, when retrieving its value using SuiteScript, the Field ID that should be used is “shippingamount” instead. The field internal id “shippingamount” is listed under Search Columns. var lookupFields = search.lookupFields({‌ type:search.Type.SALES_ORDER, id: 12345, columns: [‘shippingamount’] })

Deploy a Script via SuiteScript API

NetSuite Suite Script APIs support the creation of different standard record types, allowing for a wider customization. Included in the supported record types is also the Script Deployment record. This allows for deployments to be created programmatically when using Suite Script. It can be helpful, for example, if one single script file needs to be… Continue reading Deploy a Script via SuiteScript API

Query for custom field with type Select

There is a sublist field in a suitelet which is a list. The value of the list is to be the accounts with ELIMINATE INTERCOMPANY TRANSACTIONS checkbox checked. The search was not giving the field ELIMINATE INTERCOMPANY TRANSACTIONS checkbox. So, a query has been created as below. Note: The module N/query is to be used.… Continue reading Query for custom field with type Select

Form.removeButton(options)

This method is provided by the module N/ui/serverWidget Module to remove button. This method can be used on custom buttons and certain built-in NetSuite buttons.           function beforeLoad(context) {     var yourForm = context.form;     yourForm.removeButton(‘refund’); }         The built in button that can be removed are… Continue reading Form.removeButton(options)

Removing Mark Packed Button from Item Fulfillment record

At the moment is not possible to remove the Mark Packed button through Workflow. However, an alternative solution using SuiteScript is possible as it is described. A user event script can be used to throw an error whenever the mark packed button is clicked without satisfying the criteria. The code is given below. const beforeSubmit… Continue reading Removing Mark Packed Button from Item Fulfillment record

Setting the Create PO field to null via SuiteScript

function beforeSubmit(type){ var count = objRecord.selectLine({ sublistId: ‘item’, line: i }); for (i=1; i<= count; i++)    {         var currentContext = runtime.executionContext();         //setting of ‘createpo’ field only happens when the script is triggered via Web Services         //add other if conditions here, if needed… Continue reading Setting the Create PO field to null via SuiteScript