Change the color of the of the workflow buttons in user event script

  let color, buttonId = [];                     color = ‘ #008000’;                                       buttonId.push(‘custpageworkflow770’);                     buttonId.push(‘custpageworkflow771’);          … Continue reading Change the color of the of the workflow buttons in user event script

Disabled a standard button using client script

//‘#submitfulfill’ – is the id of the button //which can be get by the console and search the name of the button and find the id.  window.document.querySelector(‘#submitfulfill’).disabled = true; or document.querySelector(‘#submitfulfill’).disabled = true;

Alert with ok and cancel option using window function

Instead of a standard alert in client script, we can use window.confirm to get OK and Cancel options in the alert.   let waiveShipping = currentRecord.getValue({ fieldId:fieldid})                     let options = “Are you sure you want to waive shipping? Please enter the reason.”;      … Continue reading Alert with ok and cancel option using window function

How to pass the object to PDF and create a table in PDF template.

const afterSubmit = (scriptContext) => {       try {         let newRecord = scriptContext.newRecord;         let createdFrom = newRecord.getValue({ fieldId: ‘createdfrom’ })         let IFdetails = IFDetailsSearch(createdFrom);         log.debug(“IFDetails”, IFdetails)         let recordObj = record.load({           type: record.Type.SALES_ORDER,           id: createdFrom,           isDynamic: true         });         let renderer = render.create();         renderer.setTemplateById(109);//internal id the advanced pdf template         renderer.addRecord(‘record’, recordObj);          // Pass the merged data to the… Continue reading How to pass the object to PDF and create a table in PDF template.

How to add the object values only if it is available

 let body = {           “type”: “OUTBOUND”,           “details”: {             “urgent”: false,             // “arrivaldate”: itemFulRecordSearch.orderDate,             // “collect”: {             //   “requiredDate”: convertedOrderDate             // },             “deliver”: {               “address”: {                 “companyName”: itemFulRecordSearch.companyName,                 “contactName”: (itemFulRecordSearch.customer).toUpperCase(),                 “address1”: itemFulRecordSearch.shipaddress1,                 “city”: itemFulRecordSearch.shipcity,                 “state”: {                   “code”: itemFulRecordSearch.shipstate                 },                 “postcode”: itemFulRecordSearch.shipzip,                 “country”: {                   “iso2Code”: itemFulRecordSearch.shipcountry                 },                 “phone”: itemFulRecordSearch.cusPhone,                 // “email”: itemFulRecordSearch.email               },               “instructions”: itemFulRecordSearch.deliveryins,               // “requiredDate”: convertedDeliveryDate,… Continue reading How to add the object values only if it is available