- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 01:09 PM
Hi,
I have a form on which manager name is a reference type field referencing to User table. (sys_user)
There is another field called manager email address which is setup as string field. How to get email address of the selected manager into the email address field?
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 09:41 PM
Hi @swathivaddi
You can use getReference callback with an On-Change Client Script. Refer below screenshots:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.getReference('manager', getEmail); // Change the manager field name as per your catalog item
function getEmail(manager) {
g_form.setValue('email', manager.email); // Change the manager email field name as per your catalog item
}
}
Output :
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 08:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 08:43 PM
Multiple ways to achieve this. Did you tried anything so far?
Look at this article and select one of the approach to solve your usecase
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 08:56 PM
Few ways
1) why not dot walk that email field from that reference field
OR
2) use onChange , getReference callback and set the value
OR
3) use onChange + GlideAjax
what approach did you try so far and what didn't work?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 09:41 PM
Hi @swathivaddi
You can use getReference callback with an On-Change Client Script. Refer below screenshots:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.getReference('manager', getEmail); // Change the manager field name as per your catalog item
function getEmail(manager) {
g_form.setValue('email', manager.email); // Change the manager email field name as per your catalog item
}
}
Output :
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.