VMware Cloud Community
bsti
Enthusiast
Enthusiast
Jump to solution

Invoke Workflow via REST API with Input Parameter of type Any

I'm running VRO 7.3.

Has anyone successfully invoked a workflow with an input parameter of type Any before?  I'm trying it with this execution context and it's not working:

{

  "parameters": [

  {

"value": {

"properties": {

"property": [

{

"key": "p1",

"value": {

"number": {

"value": 1.0

}

}

},

{

"key": "p2",

"value": {

"string": {

"value": "two"

}

}

},

{

"key": "p3",

"value": {

"date": {

"value": 1501015223000

}

}

}

]

}

},

"type": "Any",

"name": "any",

"scope": "local"

  }

  ]

}

It passes and executes the WF, but it fails with the following error:

"Unable to convert any type ()"

I see a difference between my execution via REST and the one VRO does using the GUI:

GUI:

Properties##[#p1#=#number#1.0#+p2#=#string#two#+#p3#=#Date#20170725164023-0400#]#

pastedImage_2.png

REST:

#[#p1#=#number#1.0#+p2#=#string#two#+#p3#=#Date#20170725164023-0400#]#

pastedImage_3.png

Note the "Properties#" is missing when I call the workflow via REST.  I'm sure this is the issue, but given all of the examples I've seen I'm doing things correctly.

Any ideas are appreciated!

Reply
0 Kudos
1 Solution

Accepted Solutions
igaydajiev
VMware Employee
VMware Employee
Jump to solution

"Any" can be used to transfer object from one scripting box to another, or from scripting box to pass it as input to workflow.

But as far as I remember it was never allowed to provide input parameter of type "Any" for top level workflows.

If you create a workflow with input parameter  of type "Any" and try to run it using vRO smart client you will see that it is not editable and you can not provide  value for it.

I need to double check it but I would expect that behavior of the REST API is similar( does not accept Any as input)

If you provide a bit more details around your use case we could provide some alternative.

You could also have a workflow accepting your input as type Properties and then delegate the call to Workflow accepting parameter of type "Any"

This approach can be usefull in case you need multiple type safe top level Workflows which delegates the call to another (generic ) workflow accepting input of type "Any" to do the real work.

View solution in original post

Reply
0 Kudos
3 Replies
Burke-
VMware Employee
VMware Employee
Jump to solution

I tested this yesterday using the properties object as the type being sent in as an "any" input and was able to duplicate the error you have received. When reviewing a past workflow execution of a manually run workflow with a Properties object sent to an any input, we have the correct format.

Perhaps iiliev can look into this a bit further. My opinion is that this is a bug.

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 vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
Reply
0 Kudos
igaydajiev
VMware Employee
VMware Employee
Jump to solution

"Any" can be used to transfer object from one scripting box to another, or from scripting box to pass it as input to workflow.

But as far as I remember it was never allowed to provide input parameter of type "Any" for top level workflows.

If you create a workflow with input parameter  of type "Any" and try to run it using vRO smart client you will see that it is not editable and you can not provide  value for it.

I need to double check it but I would expect that behavior of the REST API is similar( does not accept Any as input)

If you provide a bit more details around your use case we could provide some alternative.

You could also have a workflow accepting your input as type Properties and then delegate the call to Workflow accepting parameter of type "Any"

This approach can be usefull in case you need multiple type safe top level Workflows which delegates the call to another (generic ) workflow accepting input of type "Any" to do the real work.

Reply
0 Kudos
bsti
Enthusiast
Enthusiast
Jump to solution

Thanks for replying!

I have a workflow already defined that accepts an Any input that provisions VM machines for me.   I normally call this from another WF, but I have an external system that I'm setting up to call VRO via REST where it makes more sense to call the WF with the Any input directly instead. 

I confirmed I can pass in an object of type Composite.  This is actually the workaround I'm going to use for now.  I just thought it strange that Any did not work, it really seems like it could (and should).

Thanks for taking the time to comment on this.

Reply
0 Kudos