Well, you can try to duplicate the workflow, move the existing AD:OrganizationalUnit input parameter to an attribute, add your string OU as an input parameter, and then as a first item in the workflow insert a Scriptable Task element with some code to initialize the value of AD:OrganizationalUnit attribute by using one of ActiveDirectory.search(...) scripting API using your string OU as an input.
As a last step, you need to go over the visual bindings of the existing workflow items and ensure they receive their OU from the attribute.
Thats what I am working on now. I found a nice snippet of code to covert the OU here. I do have an issue though. My virtualmachine.network0.name is getting pulled in as part of this workflow and it has a value similar to 10.10.10.0%2F24 because of the way its being read in. Do you know of a way to get rid of the last five characters? I have tried split, which works but seems to give me only the piece of the string after the split. I also tried substring but vRO doesn't like that at all. Any thoughts?
%2F looks like encoded '/'
var someStr= 'aaa%2F' System.log("original: " + someStr) System.log("decoded: " + decodeURIComponent(someStr)) System.log("substring : " + someStr.substr(0,3))
Produces in my vRO 7.3
[2017-09-19 23:15:27.698] [I] original: aaa%2F
[2017-09-19 23:15:27.702] [I] decoded: aaa/
[2017-09-19 23:15:27.707] [I] substring : aaa
I will sugest also taking a look at generic LDAP client avaialbe in AD plugin 3.0+
In case you don't need inventory objects (as input to your workflow) but rather work with string or directly with object DN's it is much easier and performance wise to use directly the generic LDAP client.
It is an encoded '/'. I am performing the action 'getavailablenetworks' so requester's can pick which network they want to build on rather than hard coding a drop down. Our networks are defined as datacenter-IP/Mask. In order to send a variable called inRange to our IPAM solution for the next available IP address in the selected IP range I needed to hash out what that range was from the network name.
Your reply reminded me that 'split' produces an array hence my object error when trying to perform another action on the resulting variable. Here is what I came up with.
var incNetName = "DC-10.10.10.0%2f24";
var tmpStr = incNetName.split('-');
var tmpRange = tmpStr.split('%');
var inRange = tmpRange;
var tempMask = incNetName.split('f');
var sMask = tempMask;
[2017-09-20 07:24:21.765] [I] 10.10.10.0
[2017-09-20 07:24:21.766] [I] 24
This allows me to send the inRange variable to Men and Mice and get the next available IP in the 10.10.10.0 range, assign it to DNS. I then perform a small case statement to define our subnet mask values. Once complete I send IP, DNS, Subnet Mask, DNS Suffix back to the blue print build. We have quite a few networks so coming up with a small function to define the mask and IP range will save me quite a few lines of code.
It's tough not having anyone here to talk to about vRO. I end up looking at things way to long and just need to step back and slap my forehead at the silliness of what is causing me a headache.
The link does not seem to resolve. I did finish up the integration though. What I ended up with was pretty slick and surprisingly small in the amount of code used.