g_form in UI Action

Jaeik Lee
Mega Sage

I made custom Reference field in RITM table, and UI Action.

In UI Action, i tried to get values in RITM. but i failed.

this is my code :

var itemVal = g_form.getDisplayValue('cat_item');
var moduleVal = g_form.getDisplayValue('u_request_module');
var typeVal = g_form.getDisplayValue('u_request_type');

 

And this works well :

var itemVal = g_form.getDisplayBox('cat_item').value;
var moduleVal = g_form.getValue('u_request_module.u_module');
var typeVal = g_form.getValue('u_request_type_label');
 
Why g_form.getDisplayValue Did not worked?
1 ACCEPTED SOLUTION

Ramkumar Thanga
Mega Sage

Hi @Jaeik Lee 

 

To get a Choicelist/DropDown list display value

 

For regular forms, use this:

var disp = g_form.getDisplayBox(“field_name”).value;

In the Service Catalog, you may have to use this instead:

var varDisp = g_form.getDisplayBox(g_form.resolveNameMap(“variable_name”)).value;
 
For your reference: 
 

 

https://www.servicenow.com/community/developer-articles/get-display-values-in-client-scripts/ta-p/23...

 

Thanks!!

Ramkumar Thangaraj

 

Please mark this as Helpful/Correct!!

View solution in original post

1 REPLY 1

Ramkumar Thanga
Mega Sage

Hi @Jaeik Lee 

 

To get a Choicelist/DropDown list display value

 

For regular forms, use this:

var disp = g_form.getDisplayBox(“field_name”).value;

In the Service Catalog, you may have to use this instead:

var varDisp = g_form.getDisplayBox(g_form.resolveNameMap(“variable_name”)).value;
 
For your reference: 
 

 

https://www.servicenow.com/community/developer-articles/get-display-values-in-client-scripts/ta-p/23...

 

Thanks!!

Ramkumar Thangaraj

 

Please mark this as Helpful/Correct!!