How to get displayValue of reference on Service Portal

Mark Roethof
Tera Patron
Tera Patron

Hi all,

I'm trying to get the display value of an entered Reference variable on a Catalog Item. So on the Service Portal (= Mobile). Though, how?!

When using for example script editor in Client Script, g_form. doesn't show any usable options. I tried manually to use g_form.getDisplayValue('field_name'), not working. g_form.getDisplayBox('field_name') also does not work (also not with added .value) (i'm doing this on the Service Portal).

Any ideas?

So for example, my reference field is 'location', and I would like to get my hands on the display value of the location (onChange or onSubmit).

I could think of a workaround to do this thru a Workflow or insert Business Rule on the variables, though would like to know if it's possible to get the display value of the just entered Reference variable.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

1 ACCEPTED SOLUTION

Omkar Mone
Mega Sage

Hi Mark,

 

Silly one but just for information, can we see if there is any display value for that table, because i was able to get the display value with g_form.getDisplayValue.Check the below ss for the same :- 

 

find_real_file.png

 

SS of the alert : -

find_real_file.png

 

Regards,

Omkar Mone.

View solution in original post

7 REPLIES 7

Harsh Vardhan
Giga Patron

are you testing it on mobile app ?

Omkar Mone
Mega Sage

Hi Mark,

 

Silly one but just for information, can we see if there is any display value for that table, because i was able to get the display value with g_form.getDisplayValue.Check the below ss for the same :- 

 

find_real_file.png

 

SS of the alert : -

find_real_file.png

 

Regards,

Omkar Mone.

AAAHHHHH it's something on our development instance. Just tested the same on PDI, also Madrid, works fine with getDisplayValue as you mentioned. Now also tested on our test instance, no issues...

I will dig into what might be different/wrong with our development instance.

Tnx.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Sounds good.

Cheers 🙂