|
| 1 | +# AuditFieldChangeNotifier |
| 2 | +### Description |
| 3 | +A ServiceNow Script Include that audits changes to specific fields and sends real-time notifications to Slack or Microsoft Teams using a webhook. |
| 4 | +It helps teams monitor important updates like priority or assignment changes without needing to check the platform. |
| 5 | +--- |
| 6 | +### 🔧 Features |
| 7 | +- Monitors field-level changes on any table |
| 8 | +- Sends rich notifications to Slack/Teams |
| 9 | +- Easy to configure via system properties |
| 10 | +- Can be reused across multiple tables via Business Rules |
| 11 | +--- |
| 12 | +### 🧩 How to Use |
| 13 | +1. **Create a System Property** |
| 14 | + - Name: `x_custom.audit_notifier.webhook_url` |
| 15 | + - Value: Your Slack or Teams webhook URL |
| 16 | +2. **Create a Script Include** |
| 17 | + - Name: `AuditFieldChangeNotifier` |
| 18 | + - Paste the provided Script Include code |
| 19 | +3. **Create a Business Rule** |
| 20 | + - Table: e.g. `incident` |
| 21 | + - When: `after update` |
| 22 | + - Add this script: |
| 23 | + ```js |
| 24 | + (function executeRule(current, previous) { |
| 25 | + var notifier = new AuditFieldChangeNotifier(); |
| 26 | + notifier.notifyOnFieldChange(current, previous, ['priority', 'state', 'assigned_to']); |
| 27 | + })(current, previous); |
| 28 | + ``` |
| 29 | +4. **Test It** |
| 30 | + - Update one of the watched fields. |
| 31 | + - A message should appear in your Slack/Teams channel like: |
| 32 | + ``` |
| 33 | + 🛠️ ServiceNow — Field Update Notification |
| 34 | + Record: Incident INC0010001 |
| 35 | + Description: Unable to access VPN |
| 36 | + • priority changed from 4 - Low → 2 - High |
| 37 | + • assigned_to changed from John → Alex |
| 38 | + ``` |
0 commit comments