3 Replies · Latest reply on Dec 1, 2017 3:02 AM by Divya Mishra

    Hide Catalog Item's Multiple Choice variable's Question Choices

      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

        • Re: Hide Catalog Item's Multiple Choice variable's Question Choices
          Rusty Luisaga

          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);

          }

          }

          }

          Please mark as Helpful or Correct. Answering questions takes time/knowledge/effort.

            • Re: Hide Catalog Item's Multiple Choice variable's Question Choices
              Narayan Saha

              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");

              }

               

               

              }Error Message.jpg

            • Re: Hide Catalog Item's Multiple Choice variable's Question Choices
              Divya Mishra

              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