getValue from multiple choice variable

SnowDevOps
Giga Guru

Hello Team

I'm trying to write a catalog client script. I have a variable (multiple-choice type) is called mac_or_pc. 1st choice is Mac and 2nd choice is PC. How do I get the value on the 1st choice & 2nd choice? I'm trying to pass values into the script include. But I got stuck on writing catalog client script. Thanks for your help. 

SnowDevOps_0-1713536554455.png

 

Normally, i write something like this below 

g_form.getValue('mac_or_pc');

or should i write something like this below to get the value of the choices:

g_form.getValue('mac_or_pc', mac); 
g_form.getValue('mac_or_pc', pc); 

 

Thanks 

7 REPLIES 7

I don't think i explain it well for you guys. I think a picture gives you a thousand words.

So, i can getValue of a variable mac_or_pc. I would write something like 

g_form.getValue('mac_or_pc'); 

my question is how do you getValue from the choices?

Would you write something like this below?

g_form.getValue('mac_or_pc', mac);
g_form.getValue('mac_or_pc', pc);

SnowDevOps_0-1713536158083.png

 

Hi @SnowDevOps ,

 

  • If you want to check which value is selected in Mac or PC, you will use the below:
var macORpc = g_form.getValue('mac_or_pc');
   alert(macORpc);

The output will be backend name of Mac/PC based on the selection.

 

  • If you want to get the display value, you need to use:
var macORpc = g_form.getDisplayValue('mac_or_pc');
   alert(macORpc);

In the portal, when I selected 'Mac' it popped the output:

SN_Learn_0-1713606603436.png

 

The below syntax is incorrect.

g_form.getValue('mac_or_pc', pc);

 

If this doesn't help, could you please explain, what is the whole requirement that you want to achieve?

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Community Alums
Not applicable

Hi @SnowDevOps

I checked you problem in my PDI and it works fine with 

g_form.getValue('mac_or_pc');

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak