14 Replies Latest reply on Nov 29, 2018 1:28 PM by daphnissov

    vRA 7.4 Custom Forms and Custom Properties

    Daniel Langenhan Enthusiast

      Hi all,

      Maybe I'm looking at it the wrong way ....

       

      I created the standard Custom Property from vRO Action getApplicableReservationPolicies  (as described in the Custom Property Doc page 116....just the normal stuff that one uses since 7.0)

      Now I thought I give the new CustomForms a go and I run into problems.

      The Property is in the selction...thats fine...BUT it dosnt use the CustomProperty definition I created. If one drags the Field onto the camvas and then runs it...it stays empty and is a text field. So next I recreated the value by setting:

      • Appearance | Display type: DropDown
      • Values | Value options: External and then com.vmware.vra.reservations/getApplicableReservationPolicies

      Running that end with an error:

      Some data cannot be retrieved. If the problem persists, contact your system administrator.;

      [1][macOS_10.13.3~ReservationPolicyID.valueList][com.vmware.vra.reservations/getApplicableReservationPolicies] Error occurred executing action. Error: [Unable to start action 'com.vmware.vra.reservations/getApplicableReservationPolicies'. Reason 'Action 'getApplicableReservationPolicies' in module 'com.vmware.vra.reservations' failed : Supplied tenant 'null' is different from the token's tenant 'applebuild' (unnamed script#9)'.]

       

      Which tells me that the context that was previously used to transport meta data between vRA and vRO isnt used anymore....

       

      ANYHOW...donst work for me.

       

      Thought/Ideas?

        • 1. Re: vRA 7.4 Custom Forms and Custom Properties
          SimonLynch Novice
          VMware Employees

          Hi Dan,

          This is a change in behaviour for custom form the out of th box action won’t work without modification.  As you identifird already the context isn’t provided by vRA, you can duplicate the action and bind the tenant as an input via custom forms you can then link the input to the tenant ref.

           

          I am still working my way through the differences between what xaas and customs forms offer.

          • 2. Re: vRA 7.4 Custom Forms and Custom Properties
            Daniel Langenhan Enthusiast

            So..yeah...I figured it out.

            Thanks @SimonLynch  ...I thought the same...but then I just went to bed with some wine.

             

            Anyhow.

            I do hope that will be fixed in 7.5, else why bother with custom Properties if one has to recreate them in the form fully again...well almost. Keep on reading.

             

            So here is what I found:

            • You need a custom Prop cause it gives the correct name for the custom prop so it is recognized in vRA for provisioning purposes. The problem is that one cant define a Name (just a label) for a new Custom field.
            • The Name (as in the machine properties that the event manager sees) are names uniquely. E.g Created an DropDown and its name (Field ID) is dropDown_1daccb4f

            • Renaming the label in CustomForms of an CustomProp only renames the Label of it not the name. The default for the label when dragged to the canvas is the Name, the already defined label is ignored.
            • Properties and Array/Stings work fine
            • Context isn't passed on to vRO (var blueprint = System.getContext().getParameter("__asd_composition_blueprintId");
            • Any settings you made in the Custom Property you created are ignored. That includes Type (String, Integer), Label, Regex, Constrains etc...EVERYTHING but the Name which becomes the Field ID
            • A custom property can only be assigned String value. E.g. You defined a Custom Property as Integer, but on the canvas you can not set the type to Integer.
            • The Constrains in the CPU and Memory Field (e.g min max) dont work work with External Values see (vRA 7.4 Custom Forms and external values ) ...smell like a bug. Tehy work with an normal integer field.
            • Integer Fields can be set to ANY value even if constraint. Meaning that you give a constraint from 1 to 4 but you are able to set -2. You cant submit (an error will be shown) but it still is pretty stupid.
            • Copying a Blueprint dosnt also copy the Custom Form one created with it.

             

             

            So here is the fix for the ReservationPolicyID

            This will create a VM in a Reservation of your choice

            • Import the attached action
            • Create a Custom Property with the name ReservationPolicyID. Just as it is...no lable and no external value
            • Add the Custom Property  to your Blueprint
            • In the Custom Form drag the ReservationID field on the canvas
            • Give it a better label
            • Set Display type to DropDown
            • In values set Value options to external source and enter the name getApplicableReservationPolicies_custom (I like that function a lot)
            • Then assign the input to the actions as seen here:

            • 3. Re: vRA 7.4 Custom Forms and Custom Properties
              Robert ¯\_ツ_/¯ Enthusiast

              Hello!

               

              I created a Custom Workflow from getApplicableNetworks and used the same input Parameter as you in your "getApplicableReservationPolicies_custom". My Problem was that if the "Blueprint Name" and the "Blueprint ID" are different the Action was failing. The ugly fix: i used the "Provider binding" instead of "Blueprint Name":

               

              and in the Action:

              Drink coffee.. Do stupid things faster with more energy...
              • 4. Re: vRA 7.4 Custom Forms and Custom Properties
                Daniel Langenhan Enthusiast

                THANKS to for finding this, good work mate

                Fixed it.

                 

                //get BlueprintID from Name
                blueprintsTMP=Server.findAllForType("vCACCAFE:CompositeBlueprint");
                for each (blueprintTMP in blueprintsTMP){
                    if (blueprintTMP.name.toUpperCase() == blueprintName.toUpperCase())
                        break;
                }
                blueprint=blueprintTMP.id;
                

                 

                See attachment.

                • 5. Re: vRA 7.4 Custom Forms and Custom Properties
                  Daniel Langenhan Enthusiast

                  So....7.5 out and tested. Results:

                   

                  What works

                  • Custom Forms are now copied when a Blueprint is copied
                  • Custom Props
                    • Variable type comes across
                    • ID comes across
                    • Label can be Changed
                    • An Drop-down defined in the Custom Properties comes across and one can select a value
                      • value
                      • external (vRO Actions) with output  Array/String or Properties
                  • Constrains work now in the as expected

                   

                  What dosn't Work:

                  • Still cant define you own ID in custom forms...just the label...
                  • Using External Workflows as input for custom Properties sometimes causes the Custom form not to load, needs a browser refresh.
                  • I can't get ReservationPolicyID to work. I get an error:

                  The following component requests failed: vSphere__vCenter__Machine_1. Allocation request [Composition RequestId: [8a55591f-362a-41bf-bddd-fbeea44e8a17], CompTypeId:  [Infrastructure.CatalogItem.Machine.Virtual.vSphere], BlueprintId: [test], CompId: [vSphere__vCenter__Machine_1], BlueprintRequestId: [c245f027-587c-4bc2-94d4-e14e2af5b8d9], RootCafeRequestId: [6548f844-339c-4008-be9c-6ea93bbee584], SubtenantId: [06890147-51f7-4857-98c7-e5b6ca2d9dcd]] with binding id [bef1c79c-1188-4cf6-9f04-41040d76816d] failed with [Infrastructure service provider error: A server error was encountered. Error requesting machine. Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).].

                   

                  Which looks like some Web problem ...lots of entries...but I must pass on that.

                   

                  EDIT 29.11.18

                  The loading and the reservationPolicyID problems are now fixed with this KB

                  VMware Knowledge Base

                   

                  EDIT 11.02.19

                  Well...the above wasnt true but a fluke that comes with the update. HERE Custom Forms ReservationPolicyID fixed (and other Properties) is how to fix that problem once and for all.

                  • 6. Re: vRA 7.4 Custom Forms and Custom Properties
                    Daniel Langenhan Enthusiast

                    IN addition to that:

                     

                    CustomForms pass on Context...however incorrectly. I can't get Reserveation ID working with external Value (via customForms not customProp) as it seem not to pass on the context on submitting.

                    • 7. Re: vRA 7.4 Custom Forms and Custom Properties
                      Daniel Langenhan Enthusiast

                      ReservationPolicyID (1st take):

                      • create as in standard Document as customProp with external value
                      • add to Blueprint
                      • works fine with nonCustomForm (creates VM)
                      • make customForm
                      • Request is working and you can select values, however after sumitting the depoyment stalls with:
                        "The following component requests failed: vSphere__vCenter__Machine_1. Allocation request [Composition RequestId: [8a55591f-362a-41bf-bddd-fbeea44e8a17], CompTypeId: [Infrastructure.CatalogItem.Machine.Virtual.vSphere], BlueprintId: [test], CompId: [vSphere__vCenter__Machine_1], BlueprintRequestId: [c245f027-587c-4bc2-94d4-e14e2af5b8d9], RootCafeRequestId: [6548f844-339c-4008-be9c-6ea93bbee584], SubtenantId: [06890147-51f7-4857-98c7-e5b6ca2d9dcd]] with binding id [bef1c79c-1188-4cf6-9f04-41040d76816d] failed with [Infrastructure service provider error: A server error was encountered. Error requesting machine. Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).]."

                       

                      ReservationPolicyID (2nd take):

                      • go to customForms and take external value from getApplicableReservationPolies (using CustomForms)
                      • request ...you are able to select the correct values (Forms pass on Context variables)
                      • However on Submitt the request stalls with :
                        "The deployment request failed when it was sent to the server. The data specified within the request is invalid. The value for the 'ReservationPolicyID' field should be among the permitted values."

                       

                      ReservationPolicyID (3rd take):

                      • go to customForms and take external value from getApplicableReservationPolies_custom (see community post)
                      • Can select values however same error as above:
                        "The deployment request failed when it was sent to the server. The data specified within the request is invalid. The value for the 'ReservationPolicyID' field should be among the permitted values."

                       

                      So basically ReservationPolicyID isnt working at the moment at all.....or Im doing something very wrong...either way...let me know

                      • 8. Re: vRA 7.4 Custom Forms and Custom Properties
                        vmitra Novice

                        HI,

                         

                        Just want to know how custom for will reflect Annotation of vSphere

                         

                        is there any specific way for it !! pls suggest

                        • 9. Re: vRA 7.4 Custom Forms and Custom Properties
                          daphnissov Guru
                          Community WarriorsvExpert

                          Hi Windspirit, I am also able to verify that the System.getContext() method doesn't work in custom forms. Is there any way you've found to work around that and get the current user (__requestedForUserId) via another method?

                          • 10. Re: vRA 7.4 Custom Forms and Custom Properties
                            Daniel Langenhan Enthusiast

                            Hi,

                            as mentioned above...you need to input the user as a parameter. But it works again in 7.5....the context at least.

                            • 11. Re: vRA 7.4 Custom Forms and Custom Properties
                              Daniel Langenhan Enthusiast

                              HI,

                              Not sure I understand your Question....

                              There is no direct correlation between vRA custom Forms and vSphere Anatoation...well except the _Notes ...but I havent tested that.

                              • 12. Re: vRA 7.4 Custom Forms and Custom Properties
                                daphnissov Guru
                                vExpertCommunity Warriors

                                My problem is I'm trying to get that user name. I can't supply that as an input parameter. I need that as an output to use in an action I'm building.

                                • 14. Re: vRA 7.4 Custom Forms and Custom Properties
                                  daphnissov Guru
                                  Community WarriorsvExpert

                                  Something else I've noticed (perhaps you too Windspirit) with custom forms, observed in 7.4 HF7 and 7.5, is when you have a custom property defined in the property dictionary with string values shown as a drop down. When you add that custom property to a custom form, it "pulls in" those values and sets the type to drop down in the custom form. But if you go back to the custom property definition and add a new string entry, this is NOT reflected in the form. The only way to "fix" this is to delete and re-add that same element to the custom form. It seems these values are only picked up when initially added and aren't actually queried from the custom property definition itself. And this is a major PITA when you have that custom property dropdown added to lots of blueprints. Not sure if anyone has found a better option at this point.