Usage of the Iterated List Element as Input for Task [ENT 21.1 OG]
While the multi instance task ("Add Item to Collection" in our example) is selected, switch to the "Input/Output" tab in the property grid.
The "Add Item to Collection" task expects two input parameters:
- CollectionPlatfromUri: The Collection Id of the collection that was created before (by "Create Collection" task)
- ItemPlatformUri: The Item Id of the item that shall be added to the collection
If one wants to add several items to a collection one should of course always use the same collection Id but different item Ids. This is where the iterated "Element Variable" comes into play.
As a collection Id we can use the output parameter of the "Create Collection" task. Let's assume we named the output parameter "CollectionId".
Select the corresponding input parameter of "Add Item to Collection", choose "Workflow Variable" as "Type of Input". Now one can select an appropriate workflow variable from the "Workflow Variable" dropdown, as in following screenshot:
The result:
Now we can use the iterated element variable as input. As shown below, select the input parameter "ItemPlatformUri" that shall get all the ID of the Items to be added to the collection.
Now one must use Expression Language to specify the input as follows:
${element.prop("ObjectId")}
Remember to use as object name that name which you provide in the "Element Variable" field. This is "element" in our example. The objects of the iterated list will be filled by MediaPortal as this workflow is intended to be a Send to workflow for MediaPortal.
One of this properties is the "ObjectId" which contains the Item Id of each corresponding assets on which the workflow was started in MediaPortal
To access to the specific properties of an JSON object you use the ".prop(<property-name>) syntax, as shown below:
${element.prop("ObjectId")}