I am setting a var like follow:
<set-variable value='#[[]]' doc:name="Set Doc Array" doc:id="bfb46451-ac45-4d73-8189-5b73cdc300b3" variableName="docHashMap"/>
Then I am trying to add elements to that list inside a foreach loop as follow:
<ee:transform doc:name="Transform Message" doc:id="ad2a1dd7-0973-4854-b44c-bdfe8eb54778">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
import * from dw::core::Binaries
output application/java
---
vars.docHashMap.add({
"Attachment_Document_Type": vars.factIntakeDocPayload.documentId,
"Attachement_Content_Type": vars.documentMetadata.contentType,
"Attachment_Content": toBase64(payload)
})]]></ee:set-payload>
</ee:message>
</ee:transform>
After the loop I have added a Logger component and I am logging the docHashMap
variable as follow:
<logger level="WARN" doc:name="Logger" doc:id="482034d9-00c2-4ae1-8fd3-e999f8ece196" message="#[vars.docHashMap]"/>
But it is empty meaning what I got on the console is just []
, why? What I am missing here? I am new to Mule4 by the way.