VMware Cloud Community
Katherines01
Contributor
Contributor
Jump to solution

Workflow to create business group/machine prefix

I'm working with vRA 6.2.1 and vRO 6.0.1 (as external appliance) creating a single workflow that I can use to reproduce my test environment in terms of the tenant creation and configuration. So far I have an overall workflow consisting of multiple workflows from the vRA plugin that will create the tenant, add identity stores and administrators and then create the fabric group and machine prefixes, this all works fine but I'm stuck at the next stage which is to create my business group. I want the workflow to take the machine prefix created in the previous step as an input into the business group creation stage, the idea being there is no administrator input apart from to start the overall workflow, but out of the box the two workflows have different formats for the machineprefix id attribute (vCACEntity and vCACCAFE:MachinePrefix), and I can't find a way to convert it which correctly passes the value of the id to the create business group workflow.

Searching the web and this forum provided two different leads around using a scriptable task between the create machine prefix and create business group workflows, I've tried both and neither seems to work for me. The first one I tried was a simple one line saying createdMachinePrefix (vCAC:Entity) = convertedmachinePrefix(vCACCAFE:MachinePrefix), and the other was a script based on the vCACCAFEEntitiesFinder (https://communities.vmware.com/message/2453675) but these both result in the error TypeError Cannot call method getId of null (Dynamic Script Module name : createBusinessGroup#3).

The problem is obviously that the machineprefix id is not being correctly converted/passed to the create business group workflow, because if I set that to use an input for the prefix id and manually type it in when I run the overall workflow it works fine, so the scriptable task isn't generating any errors but it's not giving me the end result I need either. Also when I look at the variables tab as the overall workflow executes I can see the MachinePrefix variable in vCAC:Entity format as a guid, but the vCACCAFE:MAchinePrefix shows as Not set which I think shows I've found the correct cause of the problem.

Can anyone help me find the solution, I'm sure it's just me missing something obvious but I'm new to Orchestrator and am learning as I go along.

Reply
0 Kudos
1 Solution

Accepted Solutions
jmedd
Enthusiast
Enthusiast
Jump to solution

What I do is after the element to create a MachinePrefix, add a scriptable task with the following:

IN:

machinePrefixName: string (you should be able to supply this since you would have needed it to create the MachinePrefix)

OUT:

machinePrefix: vCACCAFE:MachinePrefix

Scripting:

var vCACMachinePrefixes = Server.findAllForType("vCACCAFE:MachinePrefix");

for each (var vCACMachinePrefix in vCACMachinePrefixes) {

  if (machinePrefixName == vCACMachinePrefix.name){

  machinePrefix = vCACMachinePrefix

  break;

  }

}

Then you can use the vCACCAFE:MachinePrefix machinePrefix to create a Business Group.Of course this all assumes you are able to make MachinePrefix names unique. Alternatively, it looks like MachinePrefix has an id property you could use instead of name when searching for the right one..

Blog: http://jonathanmedd.net | Twitter: @jonathanmedd

View solution in original post

Reply
0 Kudos
2 Replies
jmedd
Enthusiast
Enthusiast
Jump to solution

What I do is after the element to create a MachinePrefix, add a scriptable task with the following:

IN:

machinePrefixName: string (you should be able to supply this since you would have needed it to create the MachinePrefix)

OUT:

machinePrefix: vCACCAFE:MachinePrefix

Scripting:

var vCACMachinePrefixes = Server.findAllForType("vCACCAFE:MachinePrefix");

for each (var vCACMachinePrefix in vCACMachinePrefixes) {

  if (machinePrefixName == vCACMachinePrefix.name){

  machinePrefix = vCACMachinePrefix

  break;

  }

}

Then you can use the vCACCAFE:MachinePrefix machinePrefix to create a Business Group.Of course this all assumes you are able to make MachinePrefix names unique. Alternatively, it looks like MachinePrefix has an id property you could use instead of name when searching for the right one..

Blog: http://jonathanmedd.net | Twitter: @jonathanmedd
Reply
0 Kudos
Katherines01
Contributor
Contributor
Jump to solution

Thanks jmedd that's worked! I did exactly as suggested, passed the script the attribute I used to define the MachinePrefix name during its creation, used your script text and then passed the value to the Create Business Group element and this time it's completed successfully.

Appreciate the help and the fast response.

Reply
0 Kudos