cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Map to tasklistener expression method in workflow

monika
Champ in-the-making
Champ in-the-making
I am using a method in my expression of activiti:tasklistener which is taking Map<String,Object> as a parameter.
Instead of passing this map inside the initail variable map, i want to create this map inside the workflow itself and want a way to edit and update its variables also inside workflow.
Is there any way to do this through activiti?

The code snippet is as below:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn"
   xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC"
   xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema"
   expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
   <collaboration id="Collaboration">
      <participant id="pool1" name="Pool" processRef="process_pool1"></participant>
   </collaboration>
   <process id="TestProcess" name="Test Process">
      <startEvent id="startevent" name="Start"></startEvent>
      <userTask id="ApprovalTaskForManager" name="Create approval task"
         activiti:dueDate="${dateVariable}">
         <extensionElements>
            <activiti:taskListener event="create"
               expression="${approvalTaskListener.processApproval("approvalActions")}" />

         </extensionElements>
      </userTask>
   </process>
</definitions>
   


Here my ("approvalActions") is a map which i dont want to pass in the initial variable map rather want to create in workflow itself. is there any way to do that?
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
Just to get it straight, you want to:

1. Use a map as a process-variable. Later in your process, you can do Map<?,?> myMap = (Map<?,?>)execution.getVariable("mapVar");

or

2. Use a map to fill process-variables. This means, every entry in the map represent a single process-variable in activiti.