VMware Cloud Community
guyhanael
Contributor
Contributor

Work Flow element issues

I duplicated the Rename VM work flow.

At the begining of the work flow I added my own work flow element.

I am trying , inside my work flow element , to get the input parameters I inserted in the Rename VM flow.

When using an action element I have got the parameters by using workflow.getInputParameters() function.

When a work flow element I did not get any parameter.

The workflow.name and workflow.id are the same but the parameters are not , is it working correctly ?

My final goal is to write a trigger and thus I must use the "waiting event" element so I must use a work flow element and not action element.

Can I mimic the "waiting event" element inside an action script by calling some routine ?

Thanks

Reply
0 Kudos
8 Replies
admin
Immortal
Immortal

Hi,

The getInputParameters method is defined on the WorkflowToken and not on the Workflow. Hence you need to call this method using the WorkflowToken.

For example, take the input parameter token of type WorkflowToken and invoke this method as follows:

var properties = token .getInputParameters();

var proptieskeys = properties .keys;

for (var i=0;i<proptieskeys .length;i++) {

System.log("The input parameters are: " +proptieskeys );

}

This would retrieve all the input parameters in a given workflow.

Hope this answers your concern.

Reply
0 Kudos
guyhanael
Contributor
Contributor

The problem is that I am trying to get the parameters inside a work flow element inside a workflow (not nested).

inside the work flow element the parameters does not exist they only exist in the "parent" flow.

Is there a way to over come it ?

Reply
0 Kudos
admin
Immortal
Immortal

I'm pretty sure you can only get the input parameters of the 'current' workflow. I don't think its possible to get the parameters of any parent workflow.

Regards,

Rob.

Reply
0 Kudos
guyhanael
Contributor
Contributor

so what is the difference between nested work flow ,which gets its own token and different id,

to a work flow element the seems to have the same id but does not hold the parent work flow parameters.

Is there a way to get the token of the parent ?

Reply
0 Kudos
admin
Immortal
Immortal

This bit of script, when run in a workflow seems to list the inputs to it's parent workflow (when inclluded as a workflow element), as well as the parent attributes.

Rob.

length = workflow.attributesStack.toString().split(",").length;

System.log(length);

for (var i =0 ; i<length ; i++) {

try {

ip = workflow.attributesStack[0];

System.log("name = " + ip[i].name);

System.log("value = " + ip[i].value);

System.log("type = " + ip[i].type);

System.log("description = " + ip[i].description);

} catch (e) {

System.error(e);

}

}

guyhanael
Contributor
Contributor

I am getting the undefined error for workflow.attributesStack .

Am I doing something wrong.

I am working with VCO 4.0.0.

Thanks

Reply
0 Kudos
admin
Immortal
Immortal

I'm using update 2.

Sorry about that. must be a new feature there.

Rob.

Reply
0 Kudos
guyhanael
Contributor
Contributor

how can I get this update ? can it be downloded or something like this ?

Is there documentation about this .

Thanks a lot Rob.

Guy.

Reply
0 Kudos