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: false
})
return true;
}
}
else {
currentRecord.getField({
fieldId: 'custbody_jj_deli_fee_reason'
}).isMandatory = false
return true;
}
}
else return true;