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-18-2024 11:54 PM
if this is the variable name -> mac_or_pc then
g_form.getValue('mac_or_pc');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2024 11:54 PM
Hi,
Use g_form.getValue('mac_or_pc');
this will give you the selected choice and you can store same in one variable and can pass to script include.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2024 11:57 PM
Hi @SnowDevOps ,
In order to get the value of it, you have to write the backend name of variable which is of multi choice.
g_form.getValue('mac_or_pc');
This should now populate the selected value: Mac/PC
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
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-19-2024 12:02 AM - edited ‎04-19-2024 12:03 AM
Hello @SnowDevOps ,
write below line in your client script
g_form.getValue('mac_or_pc');
or use on change client script for multiple choice variable.
Alert(newValue)