How to get display name of users from watch list field using glide form class.

SK Verma
Tera Contributor

1 :- When i am trying to get the value from watchlist field using "getValue()" method. It is giving me the ' sys_id' of the users.

2:- When i am trying to get the user's details using the "getReference()" method. It is not giving me the desired result.

 

SKVerma_1-1754054792153.png

 

I am trying to get the marked values.

 

Please help.

1 ACCEPTED SOLUTION

Bhimashankar H
Mega Sage

Hey @SK Verma ,

 

If you want to get the names like 'abel tutuer' from watch list then you need to use like below.

 

var gr = new GlideRecord('incident')
gr.addQuery('number', 'INC0000018')
gr.query()
if (gr.next())
    gs.info(gr.watch_list.getDisplayValue())

 

It will give all the user names which are on incident so output will look this

 

Adam Scott, Rock Helmet, Abel Tuter, Mike Mentzer

 

Thanks,
Bhimashankar H

 

----------------------------------------------------------------------------------------
If my answer helps you or resolves your query, please consider marking as 'Helpful'/'Accept As Solution'. So future readers with similar questions can find it easily. 
----------------------------------------------------------------------------------------

View solution in original post

2 REPLIES 2

Bhimashankar H
Mega Sage

Hey @SK Verma ,

 

If you want to get the names like 'abel tutuer' from watch list then you need to use like below.

 

var gr = new GlideRecord('incident')
gr.addQuery('number', 'INC0000018')
gr.query()
if (gr.next())
    gs.info(gr.watch_list.getDisplayValue())

 

It will give all the user names which are on incident so output will look this

 

Adam Scott, Rock Helmet, Abel Tuter, Mike Mentzer

 

Thanks,
Bhimashankar H

 

----------------------------------------------------------------------------------------
If my answer helps you or resolves your query, please consider marking as 'Helpful'/'Accept As Solution'. So future readers with similar questions can find it easily. 
----------------------------------------------------------------------------------------

Nikhil Bajaj9
Giga Sage

Hi @SK Verma ,

 

Getreference method should be avoided as per best practices so dont use it - Try getDisplayValue() method.

 

Regards,

Nikhil Bajaj

Please appreciate my efforts, help and support extended to you by clicking on – “Accept as Solution”; button under my answer. It will motivate me to help others as well.
Regards,
Nikhil Bajaj