Here, we just show the alert and moving back to the previous page.
function alertExpense(scriptContext) {
try {
let html = ‘<script>alert(“Please add expenses before submit.”);window.history.back();</script>’;
scriptContext.response.write(html);
}
catch (e) {
log.error(“error@alertExpense”, e);
}
}
if (sublistLineCount == –1) {
alertExpense(scriptContext);
}