Skip to content

Commit 4f9b979

Browse files
authored
Create READEME.md
1 parent 8615d4c commit 4f9b979

File tree

1 file changed

+71
-0
lines changed
  • Client-Side Components/Client Scripts/Highlight Priority Field

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# 🟢 Highlight Incident Priority Field
2+
3+
## Overview
4+
This **ServiceNow Client Script** enhances the user experience on the *Incident* form by visually highlighting the **priority field** using color indicators.
5+
It helps agents quickly identify the urgency of a ticket based on its priority level.
6+
7+
---
8+
9+
## Features
10+
- 🎨 Runs automatically on form load (`onLoad`)
11+
- ⚡ Applies background and text color styling to the `priority` field
12+
- 🧠 Uses distinct colors for each priority level:
13+
- **Critical (1)** → Red
14+
- **High (2)** → Orange
15+
- **Moderate (3)** → Yellow
16+
- **Low (4)** → Light Green
17+
- **Planning (5)** → Gray
18+
19+
---
20+
21+
## Configuration
22+
23+
| **Property** | **Value** |
24+
|---------------|-----------|
25+
| **Table** | `incident` |
26+
| **Type** | `onLoad` |
27+
| **Script Name** | `Highlight Priority Field` |
28+
| **Active** | `true` |
29+
30+
---
31+
32+
## Script
33+
34+
```javascript
35+
function onLoad() {
36+
var priority = g_form.getValue('priority');
37+
var control = g_form.getControl('priority');
38+
39+
if (control) {
40+
switch (priority) {
41+
case '1': // Critical
42+
control.style.backgroundColor = '#ff4d4d'; // Red
43+
control.style.color = 'white';
44+
control.style.fontWeight = 'bold';
45+
break;
46+
case '2': // High
47+
control.style.backgroundColor = '#ffa500'; // Orange
48+
control.style.color = 'black';
49+
control.style.fontWeight = 'bold';
50+
break;
51+
case '3': // Moderate
52+
control.style.backgroundColor = '#ffff66'; // Yellow
53+
control.style.color = 'black';
54+
control.style.fontWeight = 'bold';
55+
break;
56+
case '4': // Low
57+
control.style.backgroundColor = '#d3ffd3'; // Light Green
58+
control.style.color = 'black';
59+
control.style.fontWeight = 'bold';
60+
break;
61+
case '5': // Planning
62+
control.style.backgroundColor = '#e0e0e0'; // Gray
63+
control.style.color = 'black';
64+
control.style.fontWeight = 'bold';
65+
break;
66+
default:
67+
control.style.backgroundColor = ''; // Reset
68+
control.style.fontWeight = 'normal';
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)