Scripting · 7 min read read
ServiceNow Business Rules Examples (Before, After, Async, Display)
Practical ServiceNow Business Rules examples for before, after, async and display rules — with when to use each.
By the NowPath Institute trainer team ·
Before Business Rule: set a field
Before rules run before the database write — ideal for validating or setting values on the current record.
(function executeRule(current, previous) {
if (current.priority == 1 && current.assignment_group.nil()) {
current.assignment_group.setDisplayValue('Major Incident Team');
}
})(current, previous);After Business Rule: update related records
After rules run once the record is saved, making them suitable for updating other tables.
Async Business Rule: call an integration
Async rules run in the background, so slow work such as REST calls does not delay the user.
Display Business Rule: pass data to the client
Display rules populate g_scratchpad so Client Scripts can use server data without extra calls.
(function executeRule(current, previous) {
g_scratchpad.isVip = current.caller_id.vip == true;
})(current, previous);