Business rule: block resolving without resolution notes
A before-update business rule that stops an incident being resolved without resolution notes and tells the user why, without breaking the form.
October 1, 2026 · #business-rule #data-quality #itsm
Data quality rules belong on the server so they apply everywhere: forms, lists, imports and integrations.
// Table: incident · When: before · Update: true
// Condition: State changes to Resolved
(function executeRule(current, previous) {
if (current.close_notes.nil()) {
gs.addErrorMessage('Please add resolution notes before resolving this incident.');
current.setAbortAction(true);
}
})(current, previous);
How it works
- A before rule runs before the database write, so
setAbortAction(true)cancels the save. - Putting “State changes to Resolved” in the condition builder keeps the script tiny and avoids running on every update.
Gotchas
- Never call
current.update()in a before rule. The record is saved anyway, and you’ll trigger recursion. - A data policy or mandatory UI policy can enforce simple “field required” rules without code. Use this when you need custom logic or messaging.
MIT licence. Provided as-is, without warranty. Test in a sub-production instance first.