mmoen
12/15/2017, 9:55 PMfunction beforeLoad(context) {
if (context.type == context.UserEventType.EDIT || context.type == context.UserEventType.VIEW) {
var current_record = context.newRecord;
var customer_id = current_record.id;
var overdue_balance = getOverdueBalance(customer_id);
if (overdue_balance > 0) {
var fieldObj = context.form.addField({ id: 'custpage_banner', type: 'inlinehtml', label: ' ' });
fieldObj.defaultValue = '<div id="div_warning"><div style="margin-bottom: 10px;" class="uir-alert-box error" width="100%" role="status">' +
'<div class="icon error"></div><div class="content"><div class="title">Customer has an overdue balance</div>' +
'<div class="descr">' + 'This customer has overdue balances totalling $' + overdue_balance + '.</div></div></div></div>';
fieldObj.updateLayoutType({ layoutType: serverWidget.FieldLayoutType.OUTSIDEABOVE });
fieldObj.updateBreakType({ breakType: serverWidget.FieldBreakType.STARTROW });
}
}
}