6 Replies Latest reply on Jul 15, 2019 11:01 PM by xian_

    About Dynamic Drop-Down List "Name" and "Value"

    legioon Enthusiast

      Hi,

       

      I have two question about that.

       

      First question ; I created two dynamic dropdown custom property called via external source ( With vRealize ORchestrator );

       

      My vRO action code is ;

      ....

      ....

      return ["Production,"Development"];

      ....

      ....

       

      But, I want to write "Name" and "Values" different like picture below . Is that possible ?

       

      return [{"name" : "Production", "value" : "PROD"}] --> this is not working...

       

      My second question is ;

       

      When I click the first dropdown, second drowdown values are coming but i want to first values set as default. Because i'll hide second dropdown and values should be set as default without user selection.

       

      Thanks.

        • 1. Re: About Dynamic Drop-Down List "Name" and "Value"
          daphnissov Guru
          vExpertCommunity Warriors

          To do this, you'll need to change your action to return the type Properties. You can then do something like this sample:

           

          if (continent == "NA"){
          var props = new Properties();
          props.put("US","United States");
          props.put("Canada","Canada");
          props.put("Mexico","Mexico");
          return props;}
          

           

          continent is my input value. I'm creating a list of properties here. The first entry is the value, the second entry is the display. At the end, return the variable in which your properties are stored. The visible result is like this:

           

           

          Note that, by default, they will be sorted in ascending order alphabetically.

           

          Second question, you can't hide a drop-down altogether unless you're using custom forms in vRA 7.4. Once you expose a drop-down, it's always there, but you can either force the value of leave it null depending on if you've set it as required or not.

          • 2. Re: About Dynamic Drop-Down List "Name" and "Value"
            legioon Enthusiast

            Hi daphnissov, It works. Thank you very much!

            • 3. Re: About Dynamic Drop-Down List "Name" and "Value"
              michalpawlak Novice
              Nice work, the only problem is that I receive               
                                                 
                   
              Unexpected result from action execution. Expected [class com.vmware.vcac.platform.content.literals.MultipleLiteral], got [class com.vmware.vcac.platform.content.literals.ComplexLiteral].
                    
               
                   
                

              once list is longer e.g. 500+ results, does any of you have a solution for that problem?

              • 4. Re: About Dynamic Drop-Down List "Name" and "Value"
                _mduchaine_ Novice

                I would like to use this on a XAAS blueprint (vra 7.3). 

                The dropdown should be associated with an input parameter of my workflow. The value returned should be a number, the displayed text a string. Since the output type of the action is array/properties, I'm not able to associate the action with the original type of the attribute, number. I defined the attribute as type "properties" but couldn't associate the action either. What type should I give to my attribute in order to be able to associate with the action?

                Thanks 

                • 5. Re: About Dynamic Drop-Down List "Name" and "Value"
                  daphnissov Guru
                  Community WarriorsvExpert

                  If you're not working with properties, then you work with array/string. The return type needs to also be adjusted as necessary.

                  • 6. Re: About Dynamic Drop-Down List "Name" and "Value"
                    xian_ Enthusiast
                    I managed to do this with Dynamic types, but you need some extra coding on vRO side. Dynamic types are selectable in XaaS forms unlike Properies.