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
Author: Shanmugapriya Ganesh
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
Check pdf file size in script
//Load the file let fileObj = file.load({ id: fileId }); let fileSizeBytes = fileObj.size; let fileURL = fileObj.url; //Convert it into… Continue reading Check pdf file size in script
How to add the inventory detail set up through script
let inventoryDetailSubrecordSo = itemFulfilmentRec.getSublistSubrecord({ sublistId: ‘item’, fieldId: ‘inventorydetail’, … Continue reading How to add the inventory detail set up through script
Create Item Fulfillments for multiple locations
const createIFrecord = (newRecord) => { try { let locationArray = []; // locationArray.push(bodyLocation); let itemLineCount = newRecord.getLineCount({ sublistId: ‘item’ }); for (let i =… Continue reading Create Item Fulfillments for multiple locations
Add color to the workflow buttons using jQuery.
let color, buttonId = []; //ids of the buttons we get get the id by inspect the page and from elements we can get the IDs. color = ‘ #008000’; const changeButtonColor = (color, buttonIds) => { try { … Continue reading Add color to the workflow buttons using jQuery.
Adding two scripts in the workflow
In the workflow we can add two different workflow action scripts to meet the requirement. However, when we add the scripts in the same entry point will cause an error as ‘Record has been changed’ in the UI. So, we can use different entry points for each script. One script in entry context and another… Continue reading Adding two scripts in the workflow
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