cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to complete user task

kasit
Champ in-the-making
Champ in-the-making
I am trying to complete a user task for which fozzie is the assignee.
The code is :

TaskService taskService = processEngine.getTaskService();
List tasks = taskService.createTaskQuery().taskAssignee(user?.username)?.list();
taskService.complete(tasks.get(0).getId(),variables);

But exception occurrs as follows :

org.activiti.engine.ActivitiException: Provided id is null

at org.activiti.engine.impl.UserQueryImpl.userId(UserQueryImpl.java:53)

at Script1.run(Script1.groovy:4)

at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315)

at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111)

at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:216)

I tried
IdentityService identityService = processEngine.getIdentityService();
identityService.setAuthenticatedUserId("fozzie")
But it does not work.
I guess i am unable to create a session with user as fozzie.

Can you please help in this regard.
2 REPLIES 2

kasit
Champ in-the-making
Champ in-the-making
Has any one faced something similar??

jbarrez
Star Contributor
Star Contributor
The exception happens at

> at org.activiti.engine.impl.UserQueryImpl.userId(UserQueryImpl.java:53)

So  what does 'user?.username' in your code do?