Show alert message in Suitelet POST

/** * * @param scriptContext */ function alertMesage(scriptContext){ var html = ‘<script> alert(“The quantity should be greater than Zero”);window.close() </script>’; scriptContext.response.write(html) } The alert message will show and on clicking ok will close the whole suitelet page

Shopify NetSuite Integration via Heroku

Shopify NetSuite Integration via Heroku  Functionality Overview  Initial Heroku Setup and app creation  GitHub implementation and deploying in Heroku  Creating webhooks in Shopify  Creating a script to connect to NetSuite (Restlet) and payload conversion  Restlet in NetSuite to fetch payload and do updates  Initial Heroku Setup  Create a Heroku account and purchase a dyno (Eco),… Continue reading Shopify NetSuite Integration via Heroku

To fix a float number to specified decimal parts

/** * @description To fix a float number to specified decimal parts * @param {Number|String} value * @param {Number|String} decimals * @returns {Number|String} */ const fixFloat = (value, decimals) => { decimals = (decimals) ? decimals : 2; // return roundFloat(parseFloat(value), parseInt(decimals)).toFixed(parseInt(decimals)); return parseFloat(value).toFixed(decimals); };

Round a float number

/** * @description To round a float number * @param {Number|String} value * @param {Number|String} decimals * @returns {Number} Floating Point Number with the given precision */ const roundFloat = (value, decimals) => { decimals = (decimals) ? decimals : 2; return Number(Math.round(parseFloat(value) + ‘e’ + parseInt(decimals)) + ‘e-‘ + parseInt(decimals)); };

Assign default value

/** * @description To assign a default value if the value argument is empty * @param {String|Number|Boolean|Object|Array|null|undefined} value * @param {String|Number|Boolean|Object|Array} defaultValue * @returns {*} either value or defaultValue */ const assignDefaultValue = function assignDefaultValue(value, defaultValue) { if (checkForParameter(value)) return value; else return defaultValue; }

Transforming transfer order based on item fulfillment

/** * * @param docNum * @param IFDetails * @param ifInternalId * @return {*|number} */ function IRcreation(docNum, IFDetails, ifInternalId) { try { let trecord = record.transform({ fromType: record.Type.TRANSFER_ORDER, fromId: docNum, toType: record.Type.ITEM_RECEIPT, isDynamic: true, defaultValues: {‘itemfulfillment’: ifInternalId.toString()} }); let itemCount = trecord.getLineCount({sublistId: ‘item’}); log.debug(‘in itemCount’, itemCount); for (let i = 0; i < itemCount; i++)… Continue reading Transforming transfer order based on item fulfillment