COMPLETE USER TASK USING SERVICE TASK
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2015 09:12 AM
Hi,
i'm getting the below error when I'm trying to auto complete a user task(using service task) through a timer.
Error:
06:16:22,082 [pool-1-thread-2] WARN org.activiti.engine.delegate.event.impl.ActivitiEventSupport - Exception while executing event-listener, which was ignored
org.activiti.engine.ActivitiObjectNotFoundException: execution 275162 doesn't exist
Code:
public class WorkFlowAutoProcessing implements JavaDelegate {
@Autowired
protected TaskService taskService;
public void execute(DelegateExecution execution) throws Exception {
String currentUserTaskName = (String) execution.getVariable(WorkFlowConstants.CURRENT_USER_TASK_NAME);
TaskQuery taskQuery = taskService.createTaskQuery().taskDefinitionKey(currentUserTaskName);
taskQuery = taskService.createTaskQuery()
.processInstanceId(execution.getProcessInstanceId());
Task task = taskQuery.list().get(0);
Map<String, Object> variables=new HashMap<String, Object>();
String remarks = "Auto Processed on "+new Date();
variables.put("Remarks",remarks);
taskService.complete(task.getId(), variables);
}
}
}
Is this a right approach? or is there any other way to handle it?
Thanks in advance.
i'm getting the below error when I'm trying to auto complete a user task(using service task) through a timer.
Error:
06:16:22,082 [pool-1-thread-2] WARN org.activiti.engine.delegate.event.impl.ActivitiEventSupport - Exception while executing event-listener, which was ignored
org.activiti.engine.ActivitiObjectNotFoundException: execution 275162 doesn't exist
Code:
public class WorkFlowAutoProcessing implements JavaDelegate {
@Autowired
protected TaskService taskService;
public void execute(DelegateExecution execution) throws Exception {
String currentUserTaskName = (String) execution.getVariable(WorkFlowConstants.CURRENT_USER_TASK_NAME);
TaskQuery taskQuery = taskService.createTaskQuery().taskDefinitionKey(currentUserTaskName);
taskQuery = taskService.createTaskQuery()
.processInstanceId(execution.getProcessInstanceId());
Task task = taskQuery.list().get(0);
Map<String, Object> variables=new HashMap<String, Object>();
String remarks = "Auto Processed on "+new Date();
variables.put("Remarks",remarks);
taskService.complete(task.getId(), variables);
}
}
}
Is this a right approach? or is there any other way to handle it?
Thanks in advance.
Labels:
- Labels:
-
Archive
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2015 02:56 PM
Hi,
looks there's no execution with the given id.
Perhaps you could wrap code into a unit test?
Regards,
Yvo
looks there's no execution with the given id.
Perhaps you could wrap code into a unit test?
Regards,
Yvo
