We need to use Date Time otherwise the Date will be different based on Time Zone. We will get the system information same date and Time. /** * @description Covert the date based on the Carton Cloud format. * @param {Date} dateValue *… Continue reading Convert date to system preferred date
Author: Shanmugapriya Ganesh
Compare dates are equal in script
const areDatesEqual = (d1, d2) => { return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();… Continue reading Compare dates are equal in script
How to create alert in with Ok and cancel button in client script
if (scriptContext.fieldId == ‘custbody_jj_wave_delivery_fee’) { let deliveryWaiver = currentRecord.getValue({ fieldId: ‘custbody_jj_wave_delivery_fee’ }); if (deliveryWaiver) { let options = “Are you sure you want to waive delivery fee? Please enter the reason.”; currentRecord.getField({ fieldId: ‘custbody_jj_deli_fee_reason’ }).isMandatory = true if (window.confirm(options)) { return true; } else { currentRecord.getField({ fieldId: ‘custbody_jj_deli_fee_reason’ }).isMandatory = false currentRecord.setValue({ fieldId: ‘custbody_jj_wave_delivery_fee’, value:… Continue reading How to create alert in with Ok and cancel button in client script
How to Compare Objects with same format
The object must be same with key and their length. const compareObj = (body, ccObject) => { try { if (JSON.stringify(body) === JSON.stringify(ccObject)) return true; … Continue reading How to Compare Objects with same format
How to add value in the existing object
let body = { “type”: “OUTBOUND”, “details”: { “urgent”: false, “arrivaldate”:… Continue reading How to add value in the existing object
How to set up the inventory based on quantity
let finalQuantity = billObj.itemsListPO[lineNumber].quantity; let inventoryDetail = vendorObj.getSublistSubrecord({ sublistId: ‘item’, fieldId:… Continue reading How to set up the inventory based on quantity
How to set suite let select field options in client script.
Here we have set the puchase order list for the selecting vendor. //this is the list of vendors with their related purchase order let poList = JSON.parse(currentRecord.getValue({ fieldId: ‘custpage_polist’ })); … Continue reading How to set suite let select field options in client script.
How to render the transaction as PDF and get the PDF as Base64 encode format
let transactionFile = render.transaction({ entityId: parseInt(internal id of the transaction) printMode: render.PrintMode.PDF, … Continue reading How to render the transaction as PDF and get the PDF as Base64 encode format
How to pass parameters to suite let page by using HTML
<body> <div class=”button-container”> <form action=”#” method=”post”> <input type=”submit” value=”Logout” onclick=”logout()”> </form> </div> <script> function logout(){ alert(“You have been logged out.Please login again!”); window.open(” URL of the suitelet page which you need to open when click logout button”); window.close(); window.history.forward(); var formData = new FormData(); formData.append(‘logoutId’,true); … Continue reading How to pass parameters to suite let page by using HTML
How to create alert based on suitelet button in suitelet page
Here, we just show the alert and moving back to the previous page. function alertExpense(scriptContext) { try { let html = ‘<script>alert(“Please add expenses before submit.”);window.history.back();</script>’; scriptContext.response.write(html); … Continue reading How to create alert based on suitelet button in suitelet page