- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2024 11:56 PM
Hi Team, I want to alert when Assigned To field is changed. For that I have written onChanage Client Script on Assigned To field.
______________________________________________________________________
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
alert(newValue);
}
----------------------------------------------------------------------------------------
But when Assigned To field is changed, I'm getting Sys Id of user in Alert..
How can I alert User name of newValue..???
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 12:22 AM
Hi,
By default this will store only the sys_id of the reference field. If you like to print the display value, then use the below code :
alert(g_form.getDisplayBox('field_name'));
Note: Replace field_name with actual field name
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2024 11:19 PM
Hello @captsiddu
I hope this Answer is useful to your Question,
To alert the username instead of the Sys ID when the "Assigned To" field is changed in ServiceNow, you'll need to retrieve the username associated with the new Sys ID. You can do this by making a g_form query to get the user’s display name

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 12:22 AM
Hi,
By default this will store only the sys_id of the reference field. If you like to print the display value, then use the below code :
alert(g_form.getDisplayBox('field_name'));
Note: Replace field_name with actual field name
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 03:23 AM
alert(g_form.getDisplayBox('caller_id').value);