VMware Cloud Community
Potar
Contributor
Contributor
Jump to solution

Output from script in the Drop-down blueprint, is it possible, and how?

Hi all,

I started to work with the vRealize today, my target is to receive the output from the workflow or from the script in the Drop-down field in Blueprint form.

For the first question I just wanna ask you if it is possible in the vRealize or it is not fited to do that.

For now I have wrote the script with Array return.

The com.commonlab.emapotaa.scripts/getList function is that:

var arg0 = ["test", "test2"];

return arg0;

And my settings are:

Capture.PNG

My target is to get the JSON content and parse it to the Drop-down list.

For now I have made script running every minute to get the list and save it to file, the script will load content from the file parse it to array and return as dropdown list but its not working even with primitve array and return.

Is it possible at all?

Do you have any ideas how can I get the output of script in Drop-down input?

Thanks!

Marek Potargowicz

1 Solution

Accepted Solutions
Potar
Contributor
Contributor
Jump to solution

Hi, It is working fine for now, simple return is working dunno why it was not working before Smiley Happy

Now it is great Smiley Happy

Regards,

Marek

View solution in original post

Reply
0 Kudos
9 Replies
sbeaver
Leadership
Leadership
Jump to solution

So what is not working and what is it doing?  Do you have the action listed above with the test1 and test2 array defined as what you are using to make sure it works?  If not what is the code you are using please

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
ChristianWehner
VMware Employee
VMware Employee
Jump to solution

Hi Marek Potargowicz,

what you want to achieve should be way more easy if you directly add your action in the presentation of the workflow and then add the workflow as a new blueprint. The presentation of the workflow will then be overtaken in vRA.

Here is a good tutorial about how to modify the input presentation of workflows and how to use the output of an action as drop down values: http://solutionyst.com/vrealize-automation-using-the-vrealize-orchestrator-presentation-tab/

Hope this helps further.

Cheers,

Chris

Potar
Contributor
Contributor
Jump to solution

Hi, I did try to create new Workflow regarding that tutorial but I had some issues:

- Result from script cannot be shown in Drop-down list (it is empty).

- The result was set to output of script task:

Capture.PNG

As you can see the "res" param has the output of script already, so it is getting correct, but in the blue print is still empty.

The result on the screenshot is the res value.

Capture2.PNG

My goal for one workflow and one blue print are:

1. Get the script task done untill the blueprint is created, script is doing GET under REST and getting all urls needed (the script is showing output of Array contains Strings with URL-s).

2. Get the user to request info.

3. Show the user the Form with Drop-down list of the result of the Array/String from task no1.

4. Send another REST but now POST including some information from Form Drop-down list.

For now, the scripts or the workflows are working complety fine, but I cannot get the value in Drop-down list done.

Regards,

Marek Potargowicz

Reply
0 Kudos
ChristianWehner
VMware Employee
VMware Employee
Jump to solution

You can not have the output of a scriptable task (which is part of your workflow) to be shown on the input presentation phase of this workflow (cause it was not executed while you get the input presented).

What you have to do is to:

1. Write an action item, which returns Array containing Strings with URL-s

2. Use the tutorial to map this actions to the input presentation of your workflows input attribute

3. Only execute the POST part as part of your workflow (cause all GET operations will be executed within actions during the presentation phase of your workflow)

Cheers,

Chris

Reply
0 Kudos
Potar
Contributor
Contributor
Jump to solution

That answer is looking good, as I already tried to achive some values in the drop-down field already with no result (1st post with return the args).

I know how to handle the REST operation (GET) in workflow, but for action it wont work, cause I cannot set properly values to send and GET over REST:RESTOperation, in workflow there is no problem, but there is for the action cause the input cannot handle info from the workflow (like history of runing scripts).

We cannot also check if the action script is working or not (there is no debbuger/run button in the action page).

I could achive that while doing the save to file and read from file, but the user to run the script have no permissions, even if I grand them and made dir with 777 chmods its not working, maybe solution of permissions would fix my problems then I could achive it by save / read to file option.

Script which is not showing in the Drop-down list as a action:

var test = ["Chose 1", "Chose 2", "Choose 3"] // creating the Array of string

return test;

Its blank in Drop-down list as a Value of external script.

Any ideas ?

Reply
0 Kudos
ChristianWehner
VMware Employee
VMware Employee
Jump to solution

If you take a look into the "Invoke a REST operation" workflow, you can nearly copy&paste the code from the scriptable task into a new action. This action now could be used in your workflows input presentation. This should work easily 😉

To check if the action is working, write a "test" workflow for it with the action inside and hardcoded values to test the action and the output.

Cheers,

Chris

Reply
0 Kudos
Potar
Contributor
Contributor
Jump to solution

Yes, but the main problem is while I do the blueprint job, even if I attach the action script to the Drop-down list it is blank, I put the example on post above like:

var test = ["Test","test2"];

return test;

That action is showing the blank values instead.

Reply
0 Kudos
Potar
Contributor
Contributor
Jump to solution

Is that a issue with the vRealize / Blueprints?

Or there is different way to call the values for Drop-down lsit in action script?

Reply
0 Kudos
Potar
Contributor
Contributor
Jump to solution

Hi, It is working fine for now, simple return is working dunno why it was not working before Smiley Happy

Now it is great Smiley Happy

Regards,

Marek

Reply
0 Kudos