Why getDisplayValue() displaying sys_id instead of value for glide list type field?

Ankita Kolhe
Tera Contributor

Hi Community,

I have a glide list type field and I want to copy display value of that field to another field of string type.

 

I created a before- insert/update Business rule for the same with below code:

 

current.field1=current.field2.getDisplayValue();

gs.addInfoMessage(current.field1);

 

The above info message is displaying sys id instead of value.

 

Please someone help on this.

 

Thanks

30 REPLIES 30

@Ankita Kolhe 

you didn't answer my other question

also the field2 referring to table has some field marked as Display=true?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes one field has been marked as display = true.

@Ankita Kolhe 

can you share complete script?

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

if (previous.groupings != current.groupings)
   Please find the code below:
  
    current.entities_update_grouping_s_quick_search = current.getDisplayValue('groupings');
    gs.addInfoMessage('4: ' + current.getDisplayValue('groupings'));
 

@Ankita Kolhe 

what came in the info message?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader