- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2016 04:32 PM
I created this client scripts on the incident table.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var abc=g_form.getValue('assignment_group');
alert(abc.Name);
}
Everytime we changes the value in assignment group I want to show that value in alert. Right now its showing the sys_id value.
Please help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2016 04:43 PM
try this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var abc = g_form.getDisplayBox('assignment_group').value
alert(abc);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2021 12:54 PM
Thank you, It worked for me..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2016 05:47 PM
Hi Kulbir,
Since you are using "getValue", it should display the sys_id.
Instead, use "getReference('assignment_group')"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2016 09:31 PM
I tried the getreference and its giving the sys_id value as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2016 09:37 PM
It should return the 'sys_id', because it's a referenced field.
Afterwards, use nullreturned's below written code to get your value. That is:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var abc = g_form.getReference('assignment_group', alertName);
}
function alertName(abc) {
alert(abc.name);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2016 05:51 PM
You'll also want to ensure it's running async, rather than sync. So you'd do:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var abc = g_form.getReference('assignment_group', alertName);
}
function alertName(abc) {
alert(abc.name);
}