segadson
Contributor
Contributor

Using a function from an Action in a Scriptable task

Jump to solution

Hello,

I am new to vCO and Java Script and I was wondering if I could call an action in a scriptable task.  Basically I am creating a workflow that is integrating with vCAC and I want to pull the properties from the Virtual Machine and change the varible names to invoke a soap request for another service.  I see that in the plugin there is getPropertieFromVirutalMachine can I call that action in my scriptable task to do an update in my scritpable task to reset the varibles? Essintally I want to know if I could do something like this:

(I know that this doesnt work)

var properties = new Properties();

properties.put("VirtualMachineID", virtualMachine.virtualMachineID);

var vmProperties = {

            applicationResolver = getPropertyFromVirtualMacine(host, virtualMachine, "property");

};

System.log(applicationResolver)

or do I have to do it another way by going through the vCAC entities

0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee

var prop = System.getModule("com.vmware.library.vcac").getPropertyFromVirtualMachine(host,virtualMachine,propertyName) ;

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

0 Kudos
3 Replies
cdecanini_
VMware Employee
VMware Employee

Yes you can.

To get the syntax just drag and drop the action on your schema and copy and paste the script in the script tab of the action into your scriptable task.

The two first lines are not used for calling the action.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
cdecanini_
VMware Employee
VMware Employee

var prop = System.getModule("com.vmware.library.vcac").getPropertyFromVirtualMachine(host,virtualMachine,propertyName) ;

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

0 Kudos
segadson
Contributor
Contributor


Ahhh cool thank you so much!!!! That will save me so much Smiley Happy

0 Kudos