Populate EMail and phone of reference - reference via On change
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 07:03 PM
Can some one help me with the script
As of now we have a reference field of sys_user_grmember where we are only populating one group users
up on selecting the user we need to populate users email and phone , below is the script which is showing undefined, can some one help me where am I doing wrong?
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var user = g_form.getReference("project_commissioning_engineer", populateManager);
}
function populateManager(user) {
g_form.setValue("project_commissioning_engineer_email", user.email);
g_form.setValue("project_commissioning_engineer_phone", user.phone);
}
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 08:47 PM
you should point your reference field to sys_user and not sys_user_grmember
then your script will work fine
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader