cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign user task to a user from API?

asanchez
Champ in-the-making
Champ in-the-making
I am trying to improve the task operations rest api with another operation that allows to reassign task to other user. I have used the followed code:
ActivitiUtil.getTaskService().setAssignee(taskId, userId);
.
But it doesn't work as well as i would like it. Because it makes an entry to ACT_HI_COMMENT table but column USER_ID_ is null, and that makes activiti-explorer crash with a NULL Pointer Exception when it tries to compose the task lists.
I know that activiti-web-explorer uses the same instruction, but it records the USER_ID logged in the table.
Am I doing something wrong? Appreciate your help.

Log after executing setAssignee operation within activiti-explorer-webapp

FINE: ==>  Executing: insert into ACT_HI_COMMENT (ID_, TYPE_, TIME_, USER_ID_, TASK_ID_, PROC_INST_ID_, ACTION_, MESSAGE_, FULL_MSG_) values ( ?, ?, ?, ?, ?, ?, ?, ?, ? )
Oct 6, 2011 2:25:08 PM org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl debug
FINE: ==> Parameters: 2905(String), event(String), 2011-10-06 14:25:08.706(Timestamp), kermit(String), 2904(String), null, AddUserLink(String), gonzo_|_assignee(String), null

Log after executing setAssignee operation within activiti-rest2-webapp

FINE: ==>  Executing: insert into ACT_HI_COMMENT (ID_, TYPE_, TIME_, USER_ID_, TASK_ID_, PROC_INST_ID_, ACTION_, MESSAGE_, FULL_MSG_) values ( ?, ?, ?, ?, ?, ?, ?, ?, ? )
Oct 6, 2011 2:22:02 PM org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl debug
FINE: ==> Parameters: 3001(String), event(String), 2011-10-06 14:22:02.228(Timestamp), null, 804(String), null, AddUserLink(String), fozzie_|_assignee(String), null
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
The UserID field is filled in based on the authenticated user ID. Looks like the new version of the webapp doesn't set this before each request to the engine, I'll create a JIRA-issue for this. http://jira.codehaus.org/browse/ACT-954

Since you're in the sources already, you can implement a workaround, I suspect in the  public String authenticate(Request request, Response response) { of the ActivitiRestApplication