Need Display name from Catalog Variable

Sunny14
Tera Contributor

Hello Team, 

I have below script which gives me reference value, and I am interested to get the Display name instead. 

Can you please help me to achieve that? 

Sunny14_0-1728652524591.png

Output I get as below:

Sunny14_1-1728652588322.png

var rec = new GlideRecord("sc_req_item");
rec.addEncodedQuery("cat_item.nameSTARTSWITHPC System^approval=approved");
rec.query();
gs.info(rec.getRowCount());
while(rec.next()){
    gs.info(rec.variables.selectedPC );
}
 
 
1 ACCEPTED SOLUTION

Nick Owens1
Tera Expert

GlideRecord | ServiceNow Developers

It sounds like getDisplayValue() is what you're looking for.

 

rec.variables.selectedPC.getDisplayValue()

 

View solution in original post

2 REPLIES 2

Nick Owens1
Tera Expert

GlideRecord | ServiceNow Developers

It sounds like getDisplayValue() is what you're looking for.

 

rec.variables.selectedPC.getDisplayValue()

 

Thanks Nick. Yes this is exactly what I was looking for.

Thanks.