Hi I am trying to create a simple workflow where I create a DataCentre Object and then Create a Cluster under the DataCentre Object. The problem is I cannot find a way to take the subsequent DataCentre object from the CreateDataCentre workflow and find the HostFolder so I can then pass that as the attribute to the input of the CreateCluster workflow. I cannot find an action that will do this for me and I haven't been able to successfully write the script to to this. It seemed to me that the HostFolder was an attribute of the DataCentre object and I could reference by stating something like myhostfolder = mydatacenter.hostfolder - it has been years since I have done any scripting and when I did it was vbscript - I am obviously having some difficulty with the object model and I cannot find any sample code that would allow me to understand it a bit better.
Would really appreciate some guidance on how to do this.
Thanks
Michael
🙂
This is something I had to learn more than one time... the given value is an array as the error shows.
So it has to look like:
var myDCs = VcPlugin.getAllDatacenters();
This returns the hostFolder object. The best way is to build an action returning the value.
best regards
Christian
Hi Michael,
when you create a new datacenter you will name it like "Datacenter01". After creation you can get the new datacenter with the VcPlugin.getAllDatacenters() method and search the new Datacenter with it´s name. At this point you get the .hostFolder parameter of the new datacenter. This allows you to create the new cluster in the right datacenter
best regards
Christian
Hi Christian,
Thanks very much for the assistance - but you'll need to be patient while I am getting this. This is what I have in my script action:
When I run the workflow I get the error below
Cannot convert Datacenter<datacenter-34>'TESTDC4' to java.lang.String[] (Workflow:TechAcademy / Get HostFolder (item5)#1)
hostfiolderattrib is of type VC:HostFolder
Is the issue because my var myDC has not be defined as an object -
Thanks
🙂
This is something I had to learn more than one time... the given value is an array as the error shows.
So it has to look like:
var myDCs = VcPlugin.getAllDatacenters();
This returns the hostFolder object. The best way is to build an action returning the value.
best regards
Christian