Dynamic human task assignment, jbpm 6.x

1,286 views
Skip to first unread message

kaveh khani

unread,
May 20, 2015, 1:54:59 AM5/20/15
to jbpm-...@googlegroups.com
Hi
I want to assign human task to users dynamically. I write this code in where I create the process instance:
Map<String, Object> params = new HashMap<String, Object>();
params.put("assignee", "Jasem");
ProcessInstance processInstance = ksession.startProcess("myBpmn", params);

And in bpmn definition, in the user task node:
                ActorId=#{assignee}

I logged the assignee variable in On Entry Actions of that node like this:
              System.out.println("------------   kcontext.getVariable(assignee)  :  " + kcontext.getVariable("assignee")  +"   ---------------");

And it prints :
              ------------   kcontext.getVariable(assignee)  :  Jasem   ---------------

"Jasem" is registered as a user in and I checked it out in table "OrganizationalEntity". So it looks like everything is ok. But when I want to list the tasks assigned to "Jasem" , it gives me back an empty list. 
For other tasks that assigned to user inside bpmn definition, something like : ActorId=SomeRegisteredUser, everything is alright and this task is shown in "SomeRegisteredUser" task list. Any idea?

Thanks for reading.


Abhijit Humbe

unread,
May 20, 2015, 2:59:09 AM5/20/15
to kaveh khani, jbpm-...@googlegroups.com
HI,
I tried with same scenario at my end,and its working fine for me. I have attached standalone java code and BPMN process for your reference.
Take a look at it.Can you share simple reproducer ?

Abhijit Humbe

--
You received this message because you are subscribed to the Google Groups "jBPM Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-usage+...@googlegroups.com.
To post to this group, send email to jbpm-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-usage/87624d18-e0d6-460b-9898-de23aa44737c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

org.jbpm.DemoProcess.v3.0.bpmn2
ProcessMainJPA.java

kaveh khani

unread,
May 20, 2015, 3:37:46 AM5/20/15
to jbpm-...@googlegroups.com
Hi Abhijit and thank you for your response
Your code and process definition looks same as mine, but I could not figure out why it has different behavior. So, I guess in DB in Task.actualOwner_id and createdBy_id , TaskEvent.userId, AuditTaskImpl.actualOwner_id and createdBy_id , PeopleAssignments_PotOwners.entityId, you have correct values, right? In my DB, they are correct just for user tasks assigned statically in bpmn definition, something like :
                    ActorId=SomeRegisteredUser
I attach my process definition and java class. I will be thankful if you take look at it.
Thanks in advance.
something.java
kawaBpmn7.bpmn2

kaveh khani

unread,
May 20, 2015, 6:37:41 AM5/20/15
to jbpm-...@googlegroups.com
Hi everybody.
I resolved my problem by comparing my process definition file with what Abhijit sent. So I write this, and I hope it can resolve others who encounter the same problem. In the process definition, I set the variable "assignee" like picture 1. Compare my new process definition file with older one to find the differences between them and what caused this problem. To find out what does "assignee" is, read my previous attached files and comments.
With special thanks of Abhijit, good luck. 

On Wednesday, 20 May 2015 10:24:59 UTC+4:30, kaveh khani wrote:
1.jpg
2.jpg
kawaBpmn7_new.bpmn2

amol wani

unread,
Dec 1, 2015, 10:08:12 AM12/1/15
to jBPM Usage

Hi Kaveh,

Can you please specify version of Jbpm you using becausse I have tried with same but not getting tasks for passed user in #{assignee} process variable.
Your response will be helpful for me..

Thanks in advance.

kaveh khani

unread,
Dec 3, 2015, 1:02:53 AM12/3/15
to jBPM Usage
Hi Amol
I used jbpm 6.2. If you are using any 6.x version, I guess the problem is not the version you are using. Read my code, and the code provided by Abhijit again. Maybe you set the the 'assignee' improperly. Do you assign it to 'ActorId' property?
Reply all
Reply to author
Forward
0 new messages