g_form.getDisplayValue('priority') not fetching displayed priority value of current open incident

DPP1
Tera Contributor

Hi SysAdmin Forum

 

I am trying the below but am not being successful, need assistance !!

 

g_form.getDisplayValue('priority') not fetching displayed priority value of current open incident form's priority field

 

it is instead fetching the displayed incident number value of current open incident form's incident number field

 

Below is the code snippet that I am trying to use ->

 

=====

var priority2 = g_form.getDisplayValue('priority');
g_form.addInfoMessage(" Priority of the incident is " + priority2 );
=====

 

-----

Note ->

 

I have tried using g_form.getValue('priority') which is fetching the numerical priority value of the current open incident form's priority field

-----

 

I need to fetch the current incident form's priority field's displayed value and not its numerical value.

 

Thanks in advance for the help.

 

DPP

2 ACCEPTED SOLUTIONS

Vishal Jaswal
Giga Sage

Hello @DPP1 

 

getDisplayValue() is suitable for reference type field values. For example, caller field value of the incident form.

 

You should try below:

 

var priorityValue = g_form.getValue('priority'); // Gives you the numeric value (like 1, 2, 3, 4)
var priorityDisplay = g_form.getOption('priority', priorityValue).text; // Gets the display value

g_form.addInfoMessage("Priority of the incident is " + priorityDisplay);

 

Hope it helps!


Hope that helps!

View solution in original post

Medi C
Giga Sage

Hi @DPP1,

 

Please use:

var value = g_form.getValue('priority');
var displayValue = g_form.getOption('priority',value).text;

 


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

View solution in original post

6 REPLIES 6

Vishal Jaswal
Giga Sage

Hello @DPP1 

 

getDisplayValue() is suitable for reference type field values. For example, caller field value of the incident form.

 

You should try below:

 

var priorityValue = g_form.getValue('priority'); // Gives you the numeric value (like 1, 2, 3, 4)
var priorityDisplay = g_form.getOption('priority', priorityValue).text; // Gets the display value

g_form.addInfoMessage("Priority of the incident is " + priorityDisplay);

 

Hope it helps!


Hope that helps!

Thanks Vishal for your response with details to my query.

 

I would try to use the code per your update to see if it resolves the issue of my query.

Medi C
Giga Sage

Hi @DPP1,

 

Please use:

var value = g_form.getValue('priority');
var displayValue = g_form.getOption('priority',value).text;

 


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

DPP1
Tera Contributor

Thanks Medi C for the response with details to my query.

 

I would try to use the code per your update to see if it resolves the issue of my query.