- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 02:14 AM
Hi Experts,
I want to populate the user's name in a field named 'Responsible Person' which we have to check from the 'Email Address' field on a record producer's multi row variable set.
In above image, Email Id is a string field. We have to check that email id from sys_user table and if it's there, we have to populate that user's name in the next field which is 'Responsible person'.
Let me know the approach and possible solution on it.
Thanks in advance,
Amol Pawar
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 11:37 PM
Please adjust your function to:
getUserName: function() {
var email = this.getParameter('sysparm_email');
var user = new GlideRecord('sys_user');
user.addQuery('email', email);
user.query();
if (user.next()) {
return user.getDisplayValue('name');
}
return '';
},
If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 03:02 AM
You need to write an onChange Catalog Client Script that applies to the MRVS, not the Catalog Item, when the email variable changes. This script will use a GlideAjax call to pass the newValue to a Script Include which will lookup the user record based on the email and return the name which the client script will then populate in the other variable.
Here is an excellent guide on the process
Give it a shot and post your scripts using the insert code </> icon if you get stuck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 11:26 PM
Hi @Brad Bowman ,
I appreciate your response. I tried this approach but this is not working for me as expected. I'm adding my code here, please review it and let me know where I'm missing:
Catalog Client Script:
My email field name is 'email' is same as user table column name email, is it conflicting somehow?
Let me know your thoughts on this?
Thank you,
Amol
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 11:37 PM
Please adjust your function to:
getUserName: function() {
var email = this.getParameter('sysparm_email');
var user = new GlideRecord('sys_user');
user.addQuery('email', email);
user.query();
if (user.next()) {
return user.getDisplayValue('name');
}
return '';
},
If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2025 02:45 AM - edited ‎03-07-2025 02:46 AM
Hi @Medi C,
Thank you so much for your reply.
Thank you @Ankur Bawiskar, for your advise to not use initialize method.
with these minor changes, this is working fine.
Thank you @SyedMahemoH.
Regards,
Amol