VMware Cloud Community
FadyFawzy
Contributor
Contributor

vRA7/vRO7 : Property Dictionary - with External Values

Dears i have a situation that am created a new property in the property dictionary with external value which will be driven by a custom script action from vrealize orchestrator.

Am using the refernce of vrealize automation 7 release note which states:

In vRealize Automation 7.0, the property definitions no longer use the attributes. You must recreate the property definition or configure the property definition to use a vRealize Orchestrator script action rather than the embedded control types or attributes.

Workaround: Migrate the control type or attributes to vRealize Automation 7.0 using a script action.

    1. In vRealize Orchestrator, create a script action that returns the property values. The action must return a simple type. For example, return strings, integers, or other supported types. The action can take the other properties on which it depends as an input parameter. For information about creating script actions, see the vRealize Orchestrator documentation.
    2. In vRealize Automation, configure the product definition.

                    a. Select Administration> Property Dictionary> Property Definitions.

                    b. Select the property definition and click Edit.

                    c. From the the Display advice drop-down menu, select Dropdown

                    d. From the Values drop-down menu, select External Values

                    e. Select the script action.

                    f. Click OK

                    g. Configure the Input Parameters that are included in the script action. To preserve the existing relationship, bind the parameter to the other property.

                    h. Click OK

After i created the action script and configure everything as stated in the above paragraph. When am trying to test it it shows loading and no values are listed for the user to choose from (Am using this in normal blueprint). but when am testing the action script with ASD it works. i don't want to use ASD . i want to use the properyt definitions with external value. Could anyone help me correct my action script to work with property definition and external value .

Here is my action script:

var arr = new Array();

arr.push("Windows 2008 64bit");

arr.push(Windows 2012 64bit");

return arr;

Kindly could anyone provide me a support to solve this issue with property definitions and external values with vRealize Automation 7 and vRealize Orchestrator 7 ??

8 Replies
TrotmanRalphCBS
Enthusiast
Enthusiast

the output of the action should be string/array
0 Kudos
Avrham
Contributor
Contributor

We have the same problem.

Tried to change the output to string/array yet in the drop down list is shows "Loading" for ever...

0 Kudos
Michael_Rudloff
Enthusiast
Enthusiast

avram

Finally managed to do this myself :

http://open902.com/vrealize-automation-7-custom-property-relationships-using-actions/

___ My own knowledge base made public: http://open902.com
0 Kudos
koushik_vmware
Enthusiast
Enthusiast

Dear,

Yes, the output of the action should be string/array. I am able to populate the field successfully. But I would like to know the value of the requester/on behalf of/owner the catalog item.

So, that I can pass that values to external action and will execute some DB logic and return the result. I am wondering how can I retrieve the value of the requester of the catalog item via property dictionary ? Please help me out.

Thanks,

Koushik

0 Kudos
koushik_vmware
Enthusiast
Enthusiast

Hello,

Is there any way  how can I retrieve the value of the requester of the catalog item via property dictionary with external values/other way ?

Thanks,

Koushik

0 Kudos
tchristin
Enthusiast
Enthusiast

Hi,

I was able to find the businessGroupId by using a custom property called "my.SubtenantId", set on the businessGroup and available by default when you request a Blueprint catalog item.

This workaround helped me to give input to an external action that I developped :

Screenshot1.PNG

For a usage on user filtering, I have no idea because it's a pre-approval form so all __asd_* vars are not available.

Hope this can help for those who need a business group filter with external action.

Cheers,

Tim.

tvered
Contributor
Contributor

Hi Tim,

I was looking for this one, and it works like a charm!

After manually setting a custom ID value to the new Businees Group custom property, the vRO action received it perfectly.

Very usful Smiley Happy

Cheers,

Tal

tchristin
Enthusiast
Enthusiast

Pleasure !

I added a workflow to create/update this custom Property on all Business Groups :

var customProperty = "my.SubtenantRef"

var businessGroups = System.getModule("com.vmware.library.vcaccafe.subtenant").getAllBusinessGroups(host)

System.debug("businessGroups : " + businessGroups);

for (var i in businessGroups)

{

    System.debug("businessGroupId : " + businessGroups[i].getId());

    var businessGroup = vCACCAFEEntitiesFinder.getSubtenant(host, businessGroups[i].getId())

    System.getModule("com.vmware.library.vcaccafe.util").validateObject(businessGroup, "Business group");

    var customProperties = System.getModule("com.vmware.library.vcaccafe.subtenant").getCustomPropertyNames(businessGroup);

    System.debug("customProperties : " + customProperties);

   

    if (customProperties.indexOf(customProperty) > -1)

    {

        var subtenantRef = System.getModule("com.vmware.library.vcaccafe.subtenant").getCustomPropertyValue(businessGroup, customProperty);

       

        if (subtenantRef != businessGroups[i].getId())

        {

            System.getModule("com.vmware.library.vcaccafe.subtenant").updateCustomProperty(businessGroup, customProperty,

            customProperty, businessGroups[i].getId(), false, false);

            System.log("Custom property updated for " + businessGroups[i].getName() + " !");

        }

        else

        {

             System.log("Nothing to do for " + businessGroups[i].getName() + "...");

        }

    }

    else

    {

        System.getModule("com.vmware.library.vcaccafe.subtenant").addCustomProperty(businessGroup, customProperty,

        businessGroups[i].getId(), false, false);

        System.log("Custom property added for " + businessGroups[i].getName() + " !");

    }

}

You can schedule it so any new Business Group will have this custom property available.

Cheers,

Tim.

0 Kudos