Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Parse attributes/parameters to another workflow (which is scheduled from the first workflow)

$
0
0

Hello all,

 

Hope you can give me some input here.

 

I have migration project coming up and created a workflow to storage vmotion a VM onto a Transport Datastore. Then this workflow ends with scheduling another workflow to a user defined time (service window). The 1st workflow need to parse the vm (vc:virtualmachine) attribute and carry it over to the 2nd workflow, which then will run automated on the schedule time.

 

I cannot figure out how to parse these attributes on the 2nd workflow. I have created this "Schedule Task" script based on a script found on this blog  Create vCO/vRO scheduled workflow automatically | Chris Berry Blog

 

 

var workflowToLaunch = Server.getWorkflowWithId("b1ef0b7b-8ec6-4214-aa2d-df96b3202763");

if (workflowToLaunch == null) {

throw "Workflow not found";

}

 

var workflowParameters = new Properties();

workflowParameters.put("VM", vm);

System.log(workflowParameters.VM);

var scheduledTask = workflowToLaunch.schedule(workflowParameters,workflowScheduleDate);

 

System.log(workflowScheduleDate);

System.log(workflowParameters);

System.log(scheduledTask);

 

When I run this workflow, it run successfully, taking the VM and put it in the properties array. When I output the system.log entries you see - it all looks good.

 

The 2nd workflow is scheduled and will run on the time defined. However - it throws these errors:

 

[2015-07-15 11:47:11.073] [I] null

[2015-07-15 11:47:11.073] [I] TypeError: Cannot read property "VM" from null (Workflow:Test - Shutdown VM / Scriptable task (item2)#1)

 

In the 2nd script I have the following scriptable task with this code:

 

System.log(workflowParameters);

System.log(workflowParameters.VM);

System.log(workflowParameters.Cluster);

 

vm = workflowParameters.VM

 

System.log(vm);


After this a Shutdown VM workflow, that needs to VM as input.


I have used alot of system.logging for debugging.


One thing to notice. In the 1st workflow I use the variable "workflowParameters", which currently is not defined as an Out-parameter or Out-attribute. If I do define it as an out-parameter or attribute with type Array/Properties and run the workflow againit will throw the following error?

 

[2015-07-15 11:50:51.116] [I] Workflow:Test - start workflow / Scriptable task (item2) : ch.dunes.model.type.ConvertorException: Not an Array


Anyone can help me in the right direction?

 

Thanks in advance





Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>