Requirement
If Total Quantity exceeds 20, log a simulated notification alert in background (representing pharmacy notification).
Break the requirement into simple steps:
1. Start the business rule Function
2. Prevents null errors and false alerts(qty must exist & quantity exceeds safe threshold 20 tabs)
3. Writes info level system log(runs silently in background)
4. Clear message label as comment +Dynamically add patients name + add prescribed qty for audit
2.Types of Business Rules:
1.Before : Before the record is saved to the database.
Make fields mandatory, prevent update, change values before save, Stop duplicate records
prevent priority downgrade, prevent reopening resolved incident.
2.After : after
To trigger actions, To create/update other records, To send notifications,
Changing record after update
3.Aync : after database commit
Improve performance, heavy logic, long-running scripts, large data updates,
External integrations, Bulk notifications
4.Display: when the form is loaded.
control UI behaviour, pass data to client(g_scratchpad),show warnings, Display VIP banner.
Alternative Methods in ServiceNow
Method Can Do? Limitations
Client Script ⚠️ UI only, bypassable
UI Policy ❌ No notification capability
Data Policy ❌ Validation only
Before Business Rule ⚠️ Blocks save but not for async notify
After Business Rule ⚠️ Runs in transaction, not good for notifications
Event + Notification ✅ Requires event trigger
Flow Designer ✅ Slower but works
Scheduled Job ❌ Not real-time
Script Action ⚠️ Needs event trigger first
Async Business Rule 🏆 BESTBackground, fast, safe