Create a NetSuite search object to retrieve the status and document number of the sales order associated with the return authorization records.

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.

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 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 &&parameter !== “null” && parameter… Continue reading How to use the function checkForParamter