VMware Cloud Community
ritujain86
Contributor
Contributor

wfToken doesn't return all the output parameters of the launched workflow

Hi there,

[Details: vro 6.0.2 build: 2700137 ]

I have this below code to save the launched worflow parameters.

var wfToken = workflowToLaunch.execute(workflowParameters);

Following are the outputs of launched workflow:

1. dbUpdated (boolean)

2. errorOutput (string)

3. uuid (string)

I am trying to get the values from wfToken variable using following code:

  var outputs = wfToken.getOutputParameters();

The issue is that only dbUpdated and uuid are showing up where as errorOutput is null. I can see in the launched workflow logs that the errorOutput has a value but it shows null when I try to get it using below method. Please help.

  System.log ("+++++++++++++++++++++++" + outputs.get("uuid"))

  System.log ("+++++++++++++++++++++++" + outputs.get("errorOutput"))

  System.log ("+++++++++++++++++++++++" + outputs.get("dbUpdated"))

Thank you,

Ritu

4 Replies
iiliev
VMware Employee
VMware Employee

Hi,

Please check the following:

  • Not very likely, but there is a small chance you simply forgot to bind errorOutput as output parameter. Please check your bindings.
  • workflowToLaunch.execute() returns workflow token but it may still be running. Check the value of wfToken.state attribute, if it is still "running" and not yet "completed", you have to wait a bit for workflow execution to complete, before attempting to read output parameters.

Here is some sample code:

var wfToken = workflowToLaunch.execute(workflowParameters, user, password);

while (wfToken.state == "running") {

  System.log("still running, wait for 1 sec...");

  System.sleep(1000);

}

System.log("state -> " + wfToken.state);

var outputs = wfToken.getOutputParameters();

// proceed with fetching output parameter values

ritujain86
Contributor
Contributor

Hi IIian!

Thanks much for replying. I did check both the things you mentioned. The binding looks fine (I can see in wf run variables the errorOuput being populated and status is complete before accessing the values)  . Here is the log:

[2016-03-03 10:17:39.773] [I] Waiting for  State = running

[2016-03-03 10:18:39.780] [I] Workflow completed. Status = completed

[2016-03-03 10:18:39.786] [I] +++++++++++++++++++++++null

[2016-03-03 10:18:39.786] [I] +++++++++++++++++++++++false

[2016-03-03 10:18:39.786] [I] +++++++++++++++++++++++null

Could it be because vRO wftoken only supports one output ? In my original post I was incorrect that I saw both uuid and dbupdated populated in the same run.

0 Kudos
iiliev
VMware Employee
VMware Employee

vRO supports multiple outputs per a workflow token.

I did a quick test in my environment, and it worked fine. Could you export your 2 workflows (as .workflow files) and send them to me to take a look (either attach them here, or send them in a private message)?

ritujain86
Contributor
Contributor

Hey IIian!

Found the issue. Wasnt using the right if condition. Sorry for wasting your time Smiley Sad

  while(wfToken.state!="completed" && wfToken.state!="failed"){

  System.sleep(60000)

  }

0 Kudos