I am implementing a sequential multi instance sub process similar to the one implemented in this thread.
In that thread @StephenOTT creates a collection assigned to the variable orders in a groovy script and then sets that orders variable to the collection property of the multi instance configuration on the sub process.
I need to be able to create the collection from the results returned by an external task service.
I currently use the rest api to complete the external task but I currently only set a string variable in the body of the complete action.
I am not using java for my external service task but can easily serialize things to JSON or a JSON array if that would help accomplish this.
How do I define the properties value, type, and valueInfo to return a collection from an external service task where the external service task is not written in java so that I can use the returned variable as the collection property in the multi instance configuration of a subprocess?
So when you complete the external task this means whatever the External service was doing is complete and you can pass the array/collection of data through the complete api call
What does passing an array/collection look like in terms of the value, type, and valueInfo properties available for a variable you return when you do a post against the rest api to complete a process?
@StephenOTT Will I have to process that array with spin to turn it into something else for it to be usable as the collections property or can I just assign that variable that will be of type JSON that happens to be an array and the system will just sort it out?
@StephenOTT Still working on it, just got the code done yesterday that will now properly create a camunda variable of the type JSON for a property of an object I am returning if it doesn’t match one of the standard camunda primitive types.
Haven’t used it yet for elements collection of a multi instnace subprocess but am getting close.
What I am trying at the moment is to have an output variable named Environments from an external service task where the type is script, script format groovy, and script is ${Response.prop("Environment").elements()}.
I am hopeful that will mean that I can then just use the variable Environments as the multi instance subprocess collection value.
Hi @StephenOTT@Chris_Magnuson I’m facing a similar problem, I call a rest api and get a Json which has list of objects, from there i’m forming a json list as you mentioned above
list = {“numbers”: [12345, 23456]}
so if I pass ${list.prop(“numbers”).elements()} in collection it should work ??. correct me if I’m wrong