The CreatorCon Call for Content is officially open! Get started here.

get value of sys_id

SNnewbie2
Tera Expert

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?

1 ACCEPTED SOLUTION

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());


}


View solution in original post

7 REPLIES 7



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.



  1. var gr = new GlideRecord('sys_user');   //Query sys_user table
  2. gr.addQuery('sys_id',event.parm1.getDisplayValue());   //Query to filter the record per sys_id found in event.parm1
  3. gr.query();  
  4. if(gr.next())  
  5. {  
  6. template.print(gr.getDisplayValue());   //to get the displayValue of the user record.
  7. }

Jaspal Singh
Mega Patron
Mega Patron

Hi Claudia,



Try using



var user1=event.param1;


var user2=user1.getDisplayValue();



template.print(user2);


It didn't work. It says undefined.