When running a workflow in Vmware Orchestrator I want to add a field of list of mail addresses which the user will choose.
I have already created a workflow which runs on my Active Directory and query all the groups with address.
At the end of the workflow it arranges the information in an array of properties (NameGroup, MailAddress).
when adding a new field in Presentation tab, I can only add an action and not a workflow.
Is there another way to do it?
It is not recommended to execute workflows as part of field presentation OGNL. Compared to executing an action, the execution of a workflow is relatively expensive/slow operation, so I would recommend to implement your groups querying code as an action if you want to use it in presentation.
If you don't want to do so, an alternative would be to implement an action that internally will call the workflow, and use this action in the field presentation
Well, you already have a workflow that does it. Just create a new action using vRO Client, and then add action scripting code doing the same logic as in the workflow.
If you export your workflow as a file and attach it there we can help with the action code.
I attached the file.
Finally, I succeeded to create an action which runs a workflow and returns all the groups from the activedirectory.
But I want to present it to the user, and let him choose one.
This is my problem right now.
But I think again about the latency issue.
Is it possible to run a workflow that just queries the Active Directory server and saves the output in the orchestrator in an array or something else? I will run this workflow once a day.
And when I will need the output of the workflow, it will be available for use immediately.
Is it possible to do it through the Orchestrator?
Yes, it is possible. Open API Explorer (vRO client -> Tools -> API Explorer...) and check the documentation objects FileWriter/FileReader/File.
So you can execute your workflow once per day, collect the groups and/or the other information you need, and then write the fetched information in a text file. For example, if you need only AD group names, you can write them in the file, one AD group name per line.
Then, in your main workflow, you can read the file content, extract the stored information about the groups, and show the list to the user to choose from.
One important thing - for security reasons, file system access in JS is sandboxed. The admin has to explicitly grant access permissions (read/write/execute) for your directory/file in the file /etc/vco/app-server/js-io-rights.conf. In your case, just add the following line that will grant read, write, and execute permissions to folder /your/dir
and restart vRO service.
I changed my workflow to read from a file as you have suggested, and it works when I print the list to the console (System.log)
But my problem, as it was in my previous version, is that the the list of group does not appear for the user when I use a user interaction object.
The user interaction call an action which read from the file.
When the box appears, the field is empty.
I attached again the new workflow, maybe you will find my error.
Well, the reason for the empty field is that your action is not called at all.
Check the value of Predefined list of elements presentation property. In your workflow, you have set it to:
but to be a valid action call, it should be:
Could you export and post this action?
You are binding it to 'Predefined list of elements' so yes, it should return array of strings, not a single string.