
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 03:03 PM
I have the following in my email script :
template.print(event.parm1.getDisplayValue());
It does display a bunch of number which is the sys id. How do I get the value of the sys id of the user?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 03:17 PM
Thanks for the update Claudia, You can GlideRecord the target table to get the displayValue i.e
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',event.parm1);
gr.query();
if(gr.next())
{
template.print(gr.getDisplayValue());
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 03:26 PM
As the event.parm1 is getting sys_id input, we need to query the table to get the DisplayValue of the user. Please find comments below for the script.
- var gr = new GlideRecord('sys_user'); //Query sys_user table
- gr.addQuery('sys_id',event.parm1.getDisplayValue()); //Query to filter the record per sys_id found in event.parm1
- gr.query();
- if(gr.next())
- {
- template.print(gr.getDisplayValue()); //to get the displayValue of the user record.
- }

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 03:09 PM
Hi Claudia,
Try using
var user1=event.param1;
var user2=user1.getDisplayValue();
template.print(user2);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 03:12 PM
It didn't work. It says undefined.