- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 10:21 AM
Hi Team,
I need display auto populate email ids in the List Collector of a the users selected in another List collector in Portal.
I achieved this using Script include and Client script.
but can someone help me to show the email id instead of name in Signer email if Field using variable attributes in the variable
Script Include
var getSigneremailid = Class.create();
getSigneremailid.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getEmailid: function() {
var signeremail = this.getParameter('sysparm_signeremail');
var users = signeremail.split(','); // splits the answer by the de-limiter ","
var str = '';
for (var i = 0; i < users.length; i++) {
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", users[i]);
gr.query();
if (gr.next()) {
// str = str + gr.email + ',';
str = gr.sys_id;
}
}
return str;
},
type: 'getSigneremailid'
});
Catalog Client Script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('getSigneremailid'); //call script Include
ga.addParam('sysparm_name', 'getEmailid'); //call Required function within Script Include
ga.addParam('sysparm_signeremail', newValue);
ga.getXML(callback);
function callback(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer != null) {
g_form.setValue("signer_email", answer); // sets value to the field in the portal
} else if (answer == null) {
g_form.setValue("signer_email", '');
}
}
}
Regards,
babu
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 11:03 AM
I'm not aware of a variable attribute that allows this Service catalog variable attributes | ServiceNow Docs
You'll either need to use a string field or forgo the idea. What's the reason for duplication? You've got the users, why do you need to have a second box for their email addresses.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 10:29 AM
Hi,
If your variable Signer Email is referring to the 'sys_user' table then it will only show User Name as display value. As it is ServiceNow's OOB behavior. A table can have only one display value at a time.
Anyway, if you are auto-populating second field nbased on selection of first field then I would suggest you to make it 'Single Line Text' instead 'List Collector'. You can populate it with same client script, just return email of user instead sys_id.
Note: Also you have to apply logic to get all users emails in coma separated string in case of multiple selection.
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 10:37 AM
Hi Anil & Kieran Anson,
I need to somehow show the email id auto populated in "Signer email(s)" field in portal alone,
in the background ticket it can be names.
when googled and searched in community all I found was to use Variable attributes, which I am not aware of.
Regards,
Babu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 11:03 AM
I'm not aware of a variable attribute that allows this Service catalog variable attributes | ServiceNow Docs
You'll either need to use a string field or forgo the idea. What's the reason for duplication? You've got the users, why do you need to have a second box for their email addresses.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 10:30 AM
List collectors, similar to a reference field, use a display value that is per table and can't be overridden on a use case basis.
What you could do is set the signer names field to a string field and populate it as a comma separated field.