VMware Cloud Community
lshgfksahkjashg
Contributor
Contributor
Jump to solution

List all input params and values of rootWorkflow

Hi folks,

I tried to read the current input params and values of the current root workflow, but I failed.

I can only retrieve the input params of the current (sub) workflow, but it does not work for the main (root) workflow.

Here is an example (works only for current workflow token, not for the rootWorkflow):

https://www.funkycloudmedina.com/2018/02/enumerate-vro-workflow-inputs-into-a-json-object/

There is an attribute "parameterInfos" (see vRO API Explorer by Dr Ruurd and Flores of ITQ ), but it's undefined or not filled accordingly.

Does somebody have some hints?

Thx.

Cheers

Roland

1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

You should be able to get this info from the attributes stack of the workflow execution.

Here is some code that dumps the whole attributes stack:

var stack = workflow.attributesStack;

for each (var stackEntry in stack) {

  System.log(">>> stack entry begin");

  for each (var p in stackEntry) {

    System.log("  Param: " + p.name + " = " + p.value);

  }

  System.log("<<< stack entry end");

}

View solution in original post

4 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Please provide more information - how do your root/dub workflows look like (ideally, export and attach them there so the problem can be reproduced), how do you call the sub workflow, what parameters are there are which of them are bound to the sub workflow, what exactly is not working?

Reply
0 Kudos
lshgfksahkjashg
Contributor
Contributor
Jump to solution

The thing is: Is there an easy way to find out the current input values of the root workflow (implemented in a sub-workflow)?

I am using vRO 7.5.

I have 2 workflows:

* main

* sub

Sub workflow

var params = workflow.getInputParameters();

for (var property in params) {

    System.log(property + ": " + params.get(property));

}

Main workflow

includes only the sub workflow.

But the workflow run only prints the input params of the sub-workflow and not of the calling main/root workflow.

I would need something like this in the sub workflow:

var params = workflow.rootWorkflow.getInputParameters();

for (var property in params) {

    System.log(property + ": " + params.get(property));

}

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

You should be able to get this info from the attributes stack of the workflow execution.

Here is some code that dumps the whole attributes stack:

var stack = workflow.attributesStack;

for each (var stackEntry in stack) {

  System.log(">>> stack entry begin");

  for each (var p in stackEntry) {

    System.log("  Param: " + p.name + " = " + p.value);

  }

  System.log("<<< stack entry end");

}

lshgfksahkjashg
Contributor
Contributor
Jump to solution

Illian, you are my hero! Smiley Wink