orian
Hot Shot
Hot Shot

mail input

Jump to solution

Hi

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?

Thanks!

1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee

Your action has return type set to void; you need to change it to Array/string in the vRO client action editor.

View solution in original post

13 Replies
iiliev
VMware Employee
VMware Employee

Hi,

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 Smiley Happy

orian
Hot Shot
Hot Shot

How can I implement this in an actions?

I need to query my active directory server in order receive all the group.

Thanks!

0 Kudos
iiliev
VMware Employee
VMware Employee

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.

orian
Hot Shot
Hot Shot

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?

Thanks!

0 Kudos
iiliev
VMware Employee
VMware Employee

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

   +rwx /your/dir/ 

and restart vRO service.

Another important thing to note here is that the information stored in the file is a text, not real vRO objects (eg. you will store AD group name and possible other AD group properties but not the entire AD group javascript object). So, after you present to the user the group(s) to choose from by name, and the user chooses one or more groups, then you may need to retrieve the proper AD group object(s) by using some of the APIs provided by AD plug-in, for example ActiveDirectory.search(...)

orian
Hot Shot
Hot Shot

Hi,

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.

Thanks!

0 Kudos
iiliev
VMware Employee
VMware Employee

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:

GetAction("org.tase.newserver","ReadADGroupFromFile")

but to be a valid action call, it should be:

GetAction("org.tase.newserver","ReadADGroupFromFile").call()

orian
Hot Shot
Hot Shot

unfortunately, it is still empty...

any ideas?

0 Kudos
orian
Hot Shot
Hot Shot

Maybe, I need to convert the return type of the action from string to another object type in order to present it in the user action?

0 Kudos
iiliev
VMware Employee
VMware Employee

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.

orian
Hot Shot
Hot Shot

hope you will find my error...

0 Kudos
iiliev
VMware Employee
VMware Employee

Your action has return type set to void; you need to change it to Array/string in the vRO client action editor.

View solution in original post

orian
Hot Shot
Hot Shot

Wow, I totally forgot this parameter!

Thank you!!!

0 Kudos