unable to fetch value with getDisplayvalue command

dpi
Kilo Contributor

Hi ,

i am trying to fetch open on behalf of user Region value (service catalog form ) and i use the below script , i tried with getDisplayValue() and get value() also , both are not working- can someone please correct/suggest me -Region field is of "String type" in cmn_localtion table

function onChange(control, oldValue, newValue, isLoading) {

  var caller = g_form.getReference('open_on_behalf_of', getValue);

  function getValue(caller)

{

var k1=caller.location;

alert(k1); //getting Sys_id here

var k=new GlideRecord('cmn_location');

k.addQuery('sys_id',k1);

k.query();

alert(k); //getting object from table here   ******i used below commands to get Region value

var k2 = k.getValue('u_region');

var k2 =k.u_region.getDisplayValue();

alert(k2);

6 REPLIES 6

shivam_singhal
ServiceNow Employee
ServiceNow Employee

Hi dpi ,



can you please select the correct answer, if we have solved your use-case.


This will help others, who will be stuck in the same problem.



Thanks,
Shivam


Prateek kumar
Mega Sage

Hello Durgaprasad



Could you please close this thread by marking the appropriate answer as correct. This removes this thread from unanswered list and helps community.



Please mark my response as correct and helpful if it helped solved your question.
-Thanks