I am trying to get email address from user table using client script on my custom form. I created a reference field from the user but when I try to get the value I get the sys_id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 11:14 AM
I am trying to get email address from user table using client script on my custom form. I created a reference field from the user but when I try to get the value I get the sys_id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 11:25 AM
Can you share your script here
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 11:30 AM
Here is the client script I am trying to use.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var refcc= g_form.getValue('cc');
g_form.setValue('email', refcc);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 11:45 AM
Can you try this:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var refcc= g_form.getDisplayBox('cc').value;
g_form.setValue('email', refcc);
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2018 11:50 AM
reference field will always return the sys_id. you need to use getDisplayValue() function in your code. refcc variable is basically getting the sysid and you are trying to set that value into email field which is a string field.
replace var refcc= g_form.getDisplayValue('cc'); and it should work