Hi,
In my current workflow setup I have an End user pick their vDC and vApp Template. From there I initiate the template and once this completes I have a user interaction, to accept or deny the workflow and add what networks to attach the vApp to. This interaction is accpeted by a Operations group (different from the end user). Problem I run into is variables do not get passed back and forth between different user input. Is there a way to make this work on a Session Per User setup?
Thanks,
Mike
OK, you are getting close.
I just did the wf to test this. networkID = defaulted to "#vmNetwork1.id" is not working.
Create an action returning the id like the following:
Now default networkID like this:
(your action path / name / passed parameter will likely be different, please adapt)
If it works correctly your user interaction will look like that.
The the scriptable box with the code:
var vcdHost = app.getHost();
prodvAPPNetwork = vcdHost.getEntityById(VclFinderType.ORG_NETWORK, networkId);
System.log(prodvAPPNetwork); // I get Null
System.log(networkId); // I get #vmNetwork1.id
Executes well and gives:
[2012-08-17 15:39:38.365] [I] DynamicWrapper (Instance) : [VclOrgNetwork]-[class com.vmware.vmo.plugin.vcloud.model.OrgNetwork] -- VALUE : com.vmware.vmo.plugin.vcloud.model.OrgNetwork@39fdb480
[2012-08-17 15:39:38.366] [I] urn:vcloud:network:66812df3-3990-4d67-8e87-781eca0faf01
Christophe.
I am not sure what you mean by "variables do not get passed back and forth between different user input".
If the problem is that you want the rest of the workflow to run as another user you should use the "change credential" workflow element in the "Basic" tab.
Is the vCloud DIrector plug-in set for per user or for shared session mode ?
Christophe.
vCloud Plugin is set to Session per user
Right now if I run through the workflow as User 1 and accept the workflow and add the networks as User 1 everything works fine.
When I run the workflow as User 1 and accept the workflow and add the networks as User 2 it breaks at the "Add a Nic" workflow.
What I have noticed is that I define the network name string by doing the following
var ProdNetwork = vCDNetwork.name (vCDNetwork being the input provided during the user interaction function)
ProdNetwork will obtain a value if User 1 starts and Accepts the workflow and provides the networks
ProdNetwork will not obtain a value if User 1 starts and User 2 accepts and provides the networks.
Attached is the error I received when User 2 accepts and provides the networks.
I think you have the following issue:
When the vCD plug-in use a session per user the same vCD entity has 2 different IDs for 2 different users. If you select a network as the user 2 then it will have a given ID. When you switch back to user 1 it will not know this ID.
Try this:
In the user interaction add a networkId string input
In the presentation property set it to default to #network.id
Add a scriptable box in which you do:
network = vcdHost.getEntityById(VclFinderType.ORG_NETWORK , networkId);
(you can set vcdHost by calling the getHost() method on any object you have as input / attribute)
If this work for you then you can add a hidden presentation property on the networkId user interaction intput.
I hope this will help.
Christophe.
This was helpful but I still seem to get an error. This is what I have.
User Interaction inputs:
vmNetwork1 = Prod network
networkID = Presentation default value set to #networkID
Scriptable task
First thing you need to check if when you select a network, the networkID field is set with an ID.
You mentioned it is set to #networkID wich would not give the ID of the network, but then this may be a typo.
Once you get to this point the networkID attribute will be filled with the network ID.
Next VclFinderType should be of the type you have set for your network. i.e ORG_NETWORK. To get a list of all the types search VclFinderType in the API search.
Christophe.
Still having some trouble... Not exactly sure what I am doing wrong.
User 2 Inputs
vmNetwork1 = Prod Network
networkID = defaulted to "#vmNetwork1.id"
In my scriptable task I have
OK, you are getting close.
I just did the wf to test this. networkID = defaulted to "#vmNetwork1.id" is not working.
Create an action returning the id like the following:
Now default networkID like this:
(your action path / name / passed parameter will likely be different, please adapt)
If it works correctly your user interaction will look like that.
The the scriptable box with the code:
var vcdHost = app.getHost();
prodvAPPNetwork = vcdHost.getEntityById(VclFinderType.ORG_NETWORK, networkId);
System.log(prodvAPPNetwork); // I get Null
System.log(networkId); // I get #vmNetwork1.id
Executes well and gives:
[2012-08-17 15:39:38.365] [I] DynamicWrapper (Instance) : [VclOrgNetwork]-[class com.vmware.vmo.plugin.vcloud.model.OrgNetwork] -- VALUE : com.vmware.vmo.plugin.vcloud.model.OrgNetwork@39fdb480
[2012-08-17 15:39:38.366] [I] urn:vcloud:network:66812df3-3990-4d67-8e87-781eca0faf01
Christophe.