Using g_form.getValue for UI policy

VarunArulmani
Mega Expert

Hello All,

I am using g_form.getValue to develop an UI policy in Change Management.

This is the simple code that i used to display form variable "Configuration Item". The actual field name is cmdb_ci

var ci_name = g_form.getValue('cmdb_ci');

  g_form.showFieldMsg('cmdb_ci',ci_name,'error');

find_real_file.png

Why is it displaying a lengthy reference value? How can i convert the reference value to just display as "denj******"?

Any help is greatly appreciated. Thanks.

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Varun,



Here you go.


var ci_name = g_form.getDisplayBox('cmdb_ci').value;


  g_form.showFieldMsg('cmdb_ci',ci_name,'error');


View solution in original post

18 REPLIES 18

This one has always bothered me - to make it doubly so, it's not even documented!


Message sent to someone who might be able to do something about this.



I WANT A getDisplayValue() METHOD FOR g_form! Who's with me?!!!


We could make one with a UI Script and our friend Prototyping.


VarunArulmani
Mega Expert

Thank you all for your overwhelming responses.



Checking the answers now.