getValue from multiple choice variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 11:51 PM - edited 04-19-2024 07:25 AM
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 07:21 AM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2024 02:57 AM
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:
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2024 03:41 AM
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