need to display user email id based on user reference filed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2020 05:04 AM
i have created one catalog item under that created two variable
1. add user its referring to sys_user table
2. email id -string name -need to auto populate based on selected user.
actually my requirement is to show instead of name I want to show email id in the add user variable or else based on user selection on add user variable need to auto populate on user email in email id variable .PFA belwo screenshot.
can any one help me script
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2020 05:32 AM
Hi,
Write onChange catalog client script on user field.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var caller = g_form.getReference('user variable name', doAlert); // Change variable name
function doAlert(caller) {
g_form.setValue('email variable name', caller.email); // Change variable name
}
}
Thanks,
Dhananjay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2020 11:36 PM
In normal catalog item view below script is working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2020 11:44 PM
Hi,
Can you change the UI type of client script to mobile/service portal and then check it once.
UI Types -
1) Desktop - It will work only at client side
2)Mobile/ Service portal - Will work only on portal OR on mobile
3)All - it will work on both side(client and server)
Thanks,
Dhananjay.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2020 12:17 AM
Hello,
As per my knowledge getReference(() is not working on service portal. Have look the below code,
If answer is helpful please mark correct or helpful!
Thanks,
Pratiksha