getDisplayValue for Glide List is giving sys_id

chaslage
Kilo Guru

Not sure why but the getDisplayValue for the Glide List is coming out as sys_ids.   This Glide List (u_linked_records) is a list of entries in the Task table.

 

       var newLR = current.u_linked_records.toString();   //New Array of the Linked Records
       gs.log('SYS_ID Value: '+current.u_linked_records.toString());
       var newLRArr = newLR.split(",");
   
       var newLRNum = current.u_linked_records.getDisplayValue();   //New Array of the Linked Records with Numbers
       gs.log('Display Value: '+current.u_linked_records.getDisplayValue());
       var newLRNumArr = newLRNum.split(",");


Result:

 

SYS_ID Value: 217a717934be11003fd4f7967b28e115,52bebd7934be11003fd4f7967b28e194

Display Value: 217a717934be11003fd4f7967b28e115, 52bebd7934be11003fd4f7967b28e194

 

Any help would be appreciated.

 

Thanks!

1 ACCEPTED SOLUTION

Lam_Hoang
Kilo Expert


this should work fine for you.



https://wiki.servicenow.com/index.php?title=Referencing_a_Glide_List_from_a_Script



Did you check if you display value is set to true for the dictonary field 'number' on the task table?



Tested on calgary instance, and its working fine for me.




var gr = new GlideRecord('incident');


if (gr.get('9d385017c611228701d22104cc95c371')){


gs.print(gr.number) //show me the current incident nummer


var newLRNum = gr.u_related_records.getDisplayValue();


gs.print(newLRNum)//show me the display value of the watchlist.


}



*** Script: INC0000002


*** Script: CHG0000001, CHG0000002


View solution in original post

12 REPLIES 12

jshatney
Mega Expert

What is your display value set to on the task table?   Normally it would include the number column for display. If this has been changed, it may come back with sys_ids as the display value.


What do you mean exactly?   My numbers always display correctly, such as INT00000001, REQ00000001, etc.   The u_linked_records is a field I made myself on a custom form.


The number column is the display value, I am using the task table for the numbers.   So REQ0000001/INC00000001/SUP0000001, etc etc...



Number is set to display as true.


chaslage
Kilo Guru

Anyone have suggestions for this?



Thanks!