Hide Catalog Item's Multiple Choice variable's Question Choices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 07:39 PM
Hello Guys,
Good day! Since last two days, I am stuck with one of the requirement.
I have to hide a couple of question choices of a multiple choice variable, based on certain condition.
Kindly preview the screenshot.
I have a multiple choice variable, "Request for" with 3 question choices: SunSystems only, Vision and Vision executive only, SunSystems and Vision.
And there is another multiple choice variable, "Type of access requested": New, Change and Disable.
If I choose Request For: Vision and Vision executive only, then the Type of access requested will show: New, Change and Disable.
Else, Type of access requested would only show: Change option.
I believe, removeOption, addOption is not applicable here, as the options are always visible.
Any solution for the above urgent scenario would be highly appreciated.
Thanks and Regards,
Narayan Saha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 08:11 PM
you can set options of the 2nd multiple choice always when 1st multiple choice changes.
var multi1= g_form.getValue('select_box_var');
//Clear variable
g_form.getControl('variable').options.length = 0;
if(multi1 == "your conditon1"){
g_form.addOption('variable', option1, option1);
g_form.addOption('variable', option2, option2);
}
else if(multi1 == "your condition 2"){
g_form.addOption('variable', option3, option3);
g_form.addOption('variable', option4, option4);
}
else{
g_form.addOption('variable', option5, option5);
g_form.addOption('variable', option6, option6);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 11:07 PM
Hello Rusty,
Thanks for your quick response, as you said, I am trying to write the below onChange Catalog Client Script on the 1st Multiple Choice Variable.
However I am getting an error message in the request form.
Please find the error screenshot.
onChange Catalog Client Script:
function onChange(control, oldValue, newValue, isLoading) {
if (newValue == '') {
return;
}
//Clear variable
g_form.getControl('SCVB_accessRequested').options.length = 0;
if (newValue == "SunSystems only" || newValue == "SunSystems and Vision") {
g_form.addOption("SCVB_accessRequested","Change","Change");
}
else if(newValue == "Vision and Vision executive only") {
g_form.addOption("SCVB_accessRequested","New","New");
g_form.addOption("SCVB_accessRequested","Change","Change");
g_form.addOption("SCVB_accessRequested","Disable","Disable");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 03:02 AM
Hey Narayan,
I would recommend not to use dom manipulation here as per the best practice. One solution that comes to my mind is you can create 2 Type of access requested multichoice variables and hide them acordingly with U Policy.
Kindl try this one and post me your feedback.
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2018 03:43 AM
I agree with Divya Mishra, I would not construct complex Client scripts.
It is far better to create different variables and then use UI scripts to manage their visibility.
In General, if you find that you need complex UI scripts to manage a catalog item, this is a sign that you might need to spilt the item into more than one. I just analyed an item that was implemented like this and brokeit up in four catalog items.
They are much simpler and easier to manager. By using variable sets, I can stil reuse almost all of the variables.
Best
Daniel
If this answer was helpful, I would appreciate if you marked it as such - thanks!
Best
Daniel