12 Replies Latest reply on May 11, 2017 10:30 PM by anoopvb

    When do action runs that populate input fields?

    anoopvb Enthusiast

      I have an input field that's a string but is displayed as predefined answers which is dynamically populated using an action.

       

      My question is when do these actions run?

       

      What i'm trying to do is create a multi step workflow where the choices in the first step determine the drop down values in the second step.

       

      As of right now, there's a default value in step 1 that's populated and when i change that to another value, the input in step 2 remains the same.

       

      Is there a way to do this?

        • 1. Re: When do action runs that populate input fields?
          igaydajiev Expert
          VMware Employees

          You can use "Data binding" modifier.

          Open workflow for editing,  Chose field which value is dependent on another field and look for properties tab.

          Then add "Data binding" and use OGNL expression to refer to source field or invoke an action.

           

          https://ssbkang.com/2015/05/12/vro-deepdive-series-part-3-presentation-layer/

          VMware vRealize Automation – Using the vRealize Orchestrator presentation tab – SolutionYST

          1 person found this helpful
          • 2. Re: When do action runs that populate input fields?
            iiliev Champion
            Community WarriorsVMware Employees

            Which presentation property you used to bound the action for the input on step 2? If it is Default value, then it is executed once during the presentation creation (too early), and that's why when you try to change the value on step 1, the value on step 2 remains unchanged.

             

            If you want the value on step 2 to be computed every time you change the value it depends on on step 1, then you have to bind the action using another presentation property - Data binding.

            1 person found this helpful
            • 3. Re: When do action runs that populate input fields?
              anoopvb Enthusiast

              I'm currently using predefined answers with an OGNL call to an action that gets a list of groups to populate the input parameter.

               

              When i use "data binding" with the exact same OGNL action, i get a text field that has

               

              [Ljava.lang.Object;@df0b7ca

               

              I'm trying to get it to look like a drop down. Can i accomplish both?

              • 4. Re: When do action runs that populate input fields?
                igaydajiev Expert
                VMware Employees

                To populate "predefined list" you need an action returning Array of String values.

                While action attached to "Data binding" should return simple String value matching one of the elements from predefined list.

                 

                I will suggest

                1. Create an action that returns Array of strings and use it to populate "predefined list"

                2. Verify that list is properly verified

                3. Add another action returning simple string value matching on of "predefined list" values

                 

                Usually "predefined list"  doe snot appear as when there is error in related OGNL, attached action or it is not returning expected type.

                 

                Attaching a sample package containing simple workflow with single field (predefined list) with pre-selected "element 2"

                1 person found this helpful
                • 5. Re: When do action runs that populate input fields?
                  igaydajiev Expert
                  VMware Employees

                  Attaching one more example workflow "Copy of Predefined list with data binding" which should cover your initial use case

                  there are 2 sting inputs "inp" and "bindedInput"

                   

                  On each change of  "inp" field "bindedInput" value is updated correspondingly,

                  1 person found this helpful
                  • 6. Re: When do action runs that populate input fields?
                    anoopvb Enthusiast

                    Thank you very much. I will try this out this afternoon and report back. I'm sure i'm missing something small here so an example helps greatly!

                    • 7. Re: When do action runs that populate input fields?
                      anoopvb Enthusiast

                      So here's the difference in what i'm trying to do with the package you provided. Thank you for that.

                       

                      1. I do have an action that returns an array of strings. I verified that it works when i don't use "data binding" and just "predefined list of elements" with an action that returns the array.

                       

                      My first input variable is called "host"

                       

                      that's where the user chooses a rest host from a drop down list.

                       

                      One is already selected when the presentation occurs. So the second input variable called "group" is populated with the groups from host "hq1".

                       

                      If the user changes the "host" input to "dev1", the group input field doesn't change.

                       

                      The difference here is that the values from the "host" input field do not exist in the "group" input field.

                       

                      does that make sense?

                      • 8. Re: When do action runs that populate input fields?
                        anoopvb Enthusiast

                        So here's what i'm doing.

                         

                        When i use a predefined list of elements, this is the presentation. And if i change Appliance, the Group Name doesn't change which is as you described.

                         

                        <removed>

                         

                        when i use a data binding with the exact same OGNL action being called, this is what i get

                         

                        <removed>

                         

                        So i know that the action is returning an array of strings because that's showing up properly in the first image.

                         

                        I'm not sure what i'm missing.

                        • 9. Re: When do action runs that populate input fields?
                          iiliev Champion
                          VMware EmployeesCommunity Warriors

                          Thanks for the screenshots, it is clearer now

                           

                          In this case, the proper presentation property to use is either Predefined answers or Predefined list of elements. Not Data binding.

                           

                          Its value should look something like GetAction("com.some.module","myaction").call( #host )    (assuming your action is called myaction and it is defined in module com.some.module)

                          1 person found this helpful
                          • 10. Re: When do action runs that populate input fields?
                            anoopvb Enthusiast

                            Thank you iiliev Correct. that's what I have

                             

                            But does that mean that the "Group Name" will not change when the Appliance changes?

                             

                            And is that my only choice? I can't do what i'm trying to do here?

                             

                            thank you again.

                            • 11. Re: When do action runs that populate input fields?
                              anoopvb Enthusiast

                              Just to add some more color to the issue.

                               

                              If i don't use data binding, and use predefined answers or predefined list of elements, then the group name is populated correctly.

                               

                              But this only happens when the first choice is made by the user for "Appliance". See screen shots

                               

                              When no choice is made for "Appliance", then Group Name is blank.

                              Screen Shot 2017-05-12 at 12.00.02 AM.png

                               

                              If i change Appliance, then Group Name populates correctly with "RD Group" as expected

                              Screen Shot 2017-05-12 at 12.00.27 AM.png

                               

                              But if I go back and change "Appliance" to be another value, the Group Name does not get repopulated. In this screenshot, Group Name should be "Tst Group"

                              Screen Shot 2017-05-12 at 12.00.48 AM.png

                               

                              When i change it back to "blank", which is a value i manually added, then Group Name also becomes blank like the first screenshot.

                               

                              It seems like i'm just not doing something right here.

                               

                              Thank you again for all your help to iiliev and igaydajiev

                              • 12. Re: When do action runs that populate input fields?
                                anoopvb Enthusiast

                                I figured out the answer.

                                 

                                My action calls other actions in order to not repeat the same code over and over again.

                                 

                                In one of the actions, i had this.

                                 

                                if ( rhost = appliancename )

                                 

                                so you can see why the behavior was that it never changed

                                 

                                now it changes but i have other issues that have been discovered as a result

                                 

                                thanks again guys and sorry for the stupidity on my part.