A Multi Instance Task is capable of iterating through a list of variables or objects. The task is triggered as often as there are elements in the list that are specified in the "Collection" field.
Each element in the list is passed into each single task as a single parameter. The parameter will have the name that is specified in the "Element Variable" field. One can specify any name here, as long as one ensures that one use that name as input for the task. The parameter can be a JSON object representing an object that might have several attributes that can be accessed as described later. It can even be another JSON list object for deeper iterations.
To create a workflow input parameter of type (JSON) list, one must use following syntax:

  • The "#" introduces the list as a workflow input parameter
  • The <ListName> specifies the name as it will be provided the workflow caller (e.g. MediaPortal)
  • The <ListElementsName> specifies the name of the elements in that list as it will be provided the workflow caller (e.g. MediaPortal)

Please note that for MediaPortal the following must be considered. For its usage as a "SendTo" workflow in MediaPortal that will get a list of one or more assets, one must use the list name "WorkflowObjects". For the list elements name, "elements". MediaPortal provides the names as such.
The following expression must be used as input for the "Collection" field:
As a result, the workflow will have the parameter "WorkflowObject" as the workflow input parameter. This implies that the workflow expects a JSON object as input that represents a list of objects (e.g. to be provided by MediaPortal).

As an "Element Variable" (under the General tab) one can use any name. When you use that element later, one must use that chosen name then. In our example we will use "element".