need some help.
I am trying to add a custom field (checkbox) inside the Price Level record using form.addfield. I was able to display the checkbox it but it is not saving the value.
I also tried on afterSubmit and use setValue, however, I am not sure how to pass it on beforeLoad so I can set it on the .defaultValue, which only works on beforeLoad.
ANy possible workaround?
function beforeLoad(scriptContext) {
let objPriceLevel = scriptContext.newRecord;
let form = scriptContext.form;
try {
let fldSyncBox = form.addField({
id: "custpage_syncbox",
label: "Sync",
type: serverWidget.FieldType.CHECKBOX,
});
let bolPriceSync = objPriceLevel.getValue("custpage_syncbox");
log.debug("bolPriceSync", bolPriceSync);
fldSyncBox.defaultValue = bolPriceSync;
} catch (err) {
log.error("beforeLoad", err.message || err.name || JSON.stringify(err));
}
}