- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 06:06 AM
Greetings,
I have a catalog item with a select box and multi-row variable set. If a requestor selects a specific option in the dropdown for File Share, the customer needs a select box to be visible in the MRVS asking what type of access is needed.
My challenge is passing the value of the dropdown choice to the MRVS so that I can create a UI Policy to display the Type of Access dropdown only if that parent variable option is File Share.
Is it possible to pass the value of the dropdown option to the MRVS so that I can only show the dropdown based upon the parent variable value?
I am relatively new to scripting and have seen some examples of others passing the value in the native UI but am not sure how to pass this value for the service Portal.
Any assistance would be appreciated.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 09:01 AM
Use an onLoad Catalog Client Script that applies to the MRVS instead. Within this script, you can reference variable values on the parent form using g_service_catalog.parent.getValue('var_name')
So if this variable is named v_resource_type, and the value you're testing against is 'file_share' (be sure to use the Value column, not Text in the choice list), and given that the variable will be displayed by default, your script would simply be:
if (g_service_catalog.parent.getValue('v_resource_type') != 'file_share') {
g_form.setDisplay('v_access_type', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 09:01 AM
Use an onLoad Catalog Client Script that applies to the MRVS instead. Within this script, you can reference variable values on the parent form using g_service_catalog.parent.getValue('var_name')
So if this variable is named v_resource_type, and the value you're testing against is 'file_share' (be sure to use the Value column, not Text in the choice list), and given that the variable will be displayed by default, your script would simply be:
if (g_service_catalog.parent.getValue('v_resource_type') != 'file_share') {
g_form.setDisplay('v_access_type', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 09:21 AM
Thank you! That worked! The link was very helpful as well for explaining it all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 10:38 AM
You are welcome!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 03:14 AM
I write this just as a reminder for myself in the future. There are 3 ways found so far that you could use to pull out a value from a service catalog and use it inside the MRVS:
1. You use the command proposed by @Brad Bowman :
g_service_catalog.parent.getValue('yourVariable')
Directly under the MRVS Variable Set. Catalog Client Script applied to Variable Set.
2. Inside an OnChange Client Catalog Script (applied to catalog )-> target value your variable that you want to store. // this just gets the value
this.NOW.YOURVALUE = g_form.getValue('your variable')
Inside of MRVS you create an OnLoad Catalog Script (applied to Variable Set) -> here you just pick and use the value :
g_form.setValue('yourvariable' , this.NOW.YOURVALUE)
3. It's quite similar with the 2nd option but you use the following commands usesessionStorage.setItem and sessionStorage.getItem