Ravindar, Integrations with Mulesoft & BizTalk

Just another Integration blog

Delcare an empty array and add elements in the mule flow

We had a requirement to initialise an empty array and then collect(or add) items to it in the flow and at the end create a for loop for each of the items in that array

so we declared a flow variable with the value

#[[]]

the “[]” inside the #[] creates an empty array.

And then you can add items into this array by

flowVars.VariableName.add("your content here"); 

And at the end when you want to loop through this array, in the foreach set the this variable name flowVars.VariableName

on the other note(not related to above array), just if we want to set the pay load to null, then in setpayload shape use this

#[null]

September 12, 2019 - Posted by | Mule 3, Mulesoft

No comments yet.

Leave a comment