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