cancel
Showing results for 
Search instead for 
Did you mean: 

Rest: how to reassign a task to a different user?

f_lombardo
Champ in-the-making
Champ in-the-making
How could I reassign a task to a different user using REST API?

Thanks in advance.

Bye

Franco
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
http://activiti.org/userguide/index.html#N12B83

yes, this is a RTFM.
But at least I was friendly enough to already provide a link 😉

f_lombardo
Champ in-the-making
Champ in-the-making
First of all, thank you for your answer.

Then I'll try to explain my problem better.

Suppose I assigned a task to a user (e.g. kermit) with the API call you mentioned. Then I want to revert this assignment, giving this same task to a different user (e.g. gonzo). When I call that API the second time, I get an error at line 64 of the TaskOperationResource class.
This is because in class ClaimTaskCmd we can see:


        if(!task.getAssignee().equals(userId)) {
          // When the task is already claimed by another user, throw exception. Otherwise, ignore
          // this, post-conditions of method already met.
          throw new ActivitiTaskAlreadyClaimedException(task.getId(), task.getAssignee())

So how can I override this behavior?

Thank you.

Bye

Franco

f_lombardo
Champ in-the-making
Champ in-the-making
By the way, I'guessing if it would be better to change line 41 of class TaskOperationResource, checking for null values of the entity parameter.

Thanks.

Bye

Franco

trademak
Star Contributor
Star Contributor
Hi Franco,

Did you look at the latest version of TaskOperationResource? Because line 41 is an empty line.
In your use case you first have to invoke the unclaim operation on the TaskOperationResource.
Then the task can be assigned to another user.

Best regards,

f_lombardo
Champ in-the-making
Champ in-the-making
Sorry, I'm looking at ver 5.10 of TaskOperationResource.

I see that in the newest version of this class you introduced both the null pointer check and the unclaim operation.

Thanks a lot.

Bye

Franco