Hi exports,
1. I created a activitiManager service class wrapped activiti api in SprintMVC service layer.
2. Started a new instance by key definition.
3. Get the current task by instance id which was created in step 2.
4. Submitted the task via formService.submitTaskFormData method.
So here is the problem, steps 2-4 are in the same method, I couldn't get the current task in step 2. But I could get it when I set a break point in debugging mode.
step 2. processInstanceId= activitiManager.instanceProcessByKey(INSTANCE_KEY, currentId.toString(), keyCode, variables);
step 3. curTask = activitiManager.getActiveTaskByProcessInstanceId(processInstanceId);