- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 05:46 AM
Dear Community Members,
I am stuck in setting the background colour for the reference caller field in the 'List view of Agent workspace', which requires a condition to check whether the 'Caller (caller_id)' of the respective incident is 'VIP' or Not, if 'VIP' then display a 'Red' background colour on 'List View of Agent Workspace'. if false (i.e., Not VIP) then NO need to display any colour & keep the caller field as it is.
For this, created an onload CS on Incident table, View- workspace (Global-false), UI type- All, Isolated script- check,
Script-
function onLoad() {
g_form.getReference("caller_id", checkIfVIP);
function checkIfVIP(user) {
if (user.vip == "true")
g_form.getElement("sys_display.current.caller_id").style.backgroundColor="orange";
else
g_form.getElement("sys_display.current.caller_id").style.backgroundColor="white";
}
}
Requesting to pls correct my script to achieve the requirement.
Expecting that soon I will mark the solution Helpful & accepted!
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 01:02 AM
1. Right click on the caller field
2. go to Configure Styles.
3. Click on "New"
4. Select table where the field belongs.
5. Select the "Color" field in the Field name drop dow box.
6. In the Style field write this line: background-color:orange;
7. Submit.
also refer to this document page :
Bharath Chintala

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 06:05 AM
Hello @rishabh31
Here are some community links that you can refer to and make changes in your script accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 01:02 AM
1. Right click on the caller field
2. go to Configure Styles.
3. Click on "New"
4. Select table where the field belongs.
5. Select the "Color" field in the Field name drop dow box.
6. In the Style field write this line: background-color:orange;
7. Submit.
also refer to this document page :
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 01:25 AM - edited 03-15-2023 01:26 AM
Hi,
There are some issues with the code :-
1. The "getReference", is not a best practice to use. Instead i would recommend to use a GlideAjax call which works in sync with Script include.
Example of GlideAjax: https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet/ta-p/2312430
2. After writing the custom code mentioned in point 1, you could use the below code to fill color in reference type of field :-
g_form.getDisplayBox('caller_id').style.backgroundColor = 'orange'
Hope this helps!
Regards,
Dhruv