function (search) { function searchSalesOrder(rmaId) { try { let returnauthorizationSearchObj = search.create({ type: “returnauthorization”, filters: [ [“type”, “anyof”, “RtnAuth”], “AND”, [“internalid”, “anyof”, rmaId], “AND”, [“mainline”, “is”, “T”] ], columns: [ search.createColumn({ name: “custbody_jj_exchg_sales_order_ahap1625”, summary: “MAX”, label: “Exchange… Continue reading Create a NetSuite search object to retrieve the status and document number of the sales order associated with the return authorization records.
Author: Mindu Paul
Client script that displays a pop-up message confirming the removal of the associated RMA from the sales order while closing an exchange sales order.
function saveRecord(scriptContext) { try { let curRecord = scriptContext.currentRecord; let customForm = curRecord.getValue({ fieldId: ‘customform’ }); if (customForm == 197) { let lineCount = curRecord.getLineCount({ sublistId: ‘item’ }); let flag = 0; for (let i = 0; i < lineCount; i++) { let… Continue reading Client script that displays a pop-up message confirming the removal of the associated RMA from the sales order while closing an exchange sales order.
How to throw error in User Event script
define([‘N/runtime’, ‘N/error’], /** * @param{search} search */ (runtime, error) => { const ROLES = [ 1112 , 1046] const LOCATION = [29] const beforeLoad = (scriptContext) => { if (scriptContext.type == scriptContext.UserEventType.EDIT) { let curUser = runtime.getCurrentUser(); let curRole = curUser.role let curLoc = curUser.location … Continue reading How to throw error in User Event script
How to use search instead of loading a record
function (currentRecord, search) { }
How to use the function checkForParamter
It is a function to validate a parameter. It will check if the parameter meets certain conditions for validity. The example of the code is shown below. const checkForParameter = function checkForParameter(parameter) {try { if (parameter !== “” && parameter !== null && parameter !== undefined && parameter !== false &¶meter !== “null” && parameter… Continue reading How to use the function checkForParamter
To create a custom field in RMA records
Navigate to Customization > Lists, Records and Fields > Transaction Body Fields > New to create the custom field. Then fill the necessary fields such as label and Id. And select the checkbox ‘sale’ under the ‘Applies to’ subtab and also fill the display settings. Afte filling the necessary details select ‘save and apply to… Continue reading To create a custom field in RMA records