Activiti获取UserTask任务表单

Activiti获取UserTask任务表单

ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
FormService formService = processEngine.getFormService();
TaskService taskService = processEngine.getTaskService();
TaskQuery taskQuery = taskService.createTaskQuery();
taskQuery.processInstanceId(processInstanceId);
Task task = taskQuery.singleResult();
//流程中用到的参数需要放入map中
Map map = new HashMap<>();
//通过任务ID获取任务表单数据
TaskFormData taskFormData = formService.getTaskFormData(task.getId());
for (FormProperty formProperty : taskFormData.getFormProperties()) {
//打印表单属性
System.out.println(formProperty.getName());
System.out.println(formProperty.getId());
System.out.println(formProperty.getType().getName());
}
//提交表单(带参数)
formService.submitTaskFormData(task.getId(), map);

你可能感兴趣的:(Activiti获取UserTask任务表单)