When I use the Scriptable Task 99% of the time what I need to do centers around if/then/else, loops, data structures (arrays, objects), common method calling (the System object, the Server object, and plugin objects) variable retrieval (vm.config.hardware.numCPU), and string transformation (character strip, match, substring, format, etc). So what does that really look like? In this example our vCloud Automation center needs to add a machine to AD as part of the post provisioning process. The “ou” parameter is passed in to the vCO flow, and we will use the AD plugin to search for the AD:OrganizationalUnit object and assign that object to the “group” variable. The group variable gets bound as an “Attribute” in our workflow and then passed in to the “Create a computer…” workflow element in order to add the server to the specified OU. But first we must do some basic error checking to determine if the group exists first.
This could be a 7-10 element flow if you used the flow control elements and the Active Directory Plug-In actions in a flow.
A little if/then/else error checking, and then pluck the first matching group off of the returned array – DONE!
WHEW* simple right?
Also, some best practices around flow creation with Scriptable objects is that you are creating re-usable packages. So each one should be a short block of about 20-30 lines, and you should try to rename them that describes what they do. For example:
It’s easier to understand what this does:
Article by: Jennifer Galvin – Sr. Systems Engineer