If we need to do any functionality in the cancel trigger without using lineinit entry point we can use the following in the pageInit entry point.
document.querySelector(‘input[type=”button”][value=”Cancel”]’).addEventListener(‘click’, function (event) {
console.log(“entered custom cancel button”)
let sublistId = “recmachcustrecord_vr_svcord_item”;
let lineCount = curRec.getLineCount({ sublistId: sublistId });
// Loop through existing sublist lines and commit them
curRec.selectLine({ sublistId: sublistId, line: lineCount – 1 });
curRec.commitLine({ sublistId: sublistId });
});