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

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Claudia,



Can you please paste gs.eventQueue script here.


gs.eventQueue('catalog.opening.dns.notification', current, user, au.unique(recipients[user]).join(', '));



var au = new ArrayUtil();




//gs.info('Object' + JSON.stringify(recipients));




for (var user in recipients) {


gs.eventQueue('catalog.opening.dns.notification', current, user, au.unique(recipients[user]).join(', '));


              // gs.print (user + '='+ recipients[key]);


}


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


}


Why do I need to query the table? why   does "template.print(event.parm1.getDisplayValue());   ' didn't work?




var gr = new GlideRecord('sys_user');


gr.addQuery('sys_id',event.parm1.getDisplayValue());


gr.query();


if(gr.next())


{


template.print(gr.getDisplayValue());


}



In line 02 : sys_id meand you are filtering sys_ids... how about event.parm1.???



Could you explain me your script line by line please?