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

Ankur Bawiskar
Tera Patron
Tera Patron

@Ankita Kolhe 

are you in scoped app or global scope?

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

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur Bawiskar ,

 

It's scoped app & display value is false for field2.

@Ankita Kolhe 

then try this

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

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

I tried this but not working.