current.variables.variablename.getDisplayValue() not working

RudhraKAM
Tera Guru

I have a variable A whose type is Reference

when i tried to to create a change using that

change.change_plan =("Remove the filter: " + current.variables.A.getDisplayValue());   its returning me the   value "undefined"

1 ACCEPTED SOLUTION

Thanks pradeep   and Venkat



actually its working fine with current.request_item.variables.A.getDisplayValue()


View solution in original post

4 REPLIES 4

venkatiyer1
Giga Guru

Hi Kammila,



Hope you have logged current.variables.A to check whether it gives the sys_id of the reference field. Since it gives the sys id and not a glide reference you would have to access the table with the curretnt.variables.A against the sys_id to either get the display value or the column which has a display value of true.


Hello Venkat   Thanks for the Reply



I tried that as well , I am getting   undefined


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Kammila,



current.variables.VARIABLENAME.getDisplayValue() will work if you are trying to fetch on the requested item table. Can you please make sure the variable name is correct? Can you share the screenshot of the variable and give details where you are writing this script.


Thanks pradeep   and Venkat



actually its working fine with current.request_item.variables.A.getDisplayValue()