AnsweredAssumed Answered

Loading previous task data

Question asked by raja_activiti on Dec 3, 2014
Latest reply on Dec 8, 2014 by jbarrez
I have a scenario,
In my form there is previous button to view previous screen, I have provided transition to previous task in BPMN.
My question is I need to populate the form data entered previously. So I have written below code, Can any one suggest me my approach is correct, or guide me right approach.

          List<HistoricActivityInstance> list = historyService.createHistoricActivityInstanceQuery()      .processInstanceId(processInstanceId).finished().orderByHistoricActivityInstanceEndTime().desc().list();
          if(list.size() > 0) {
             HistoricActivityInstance historicActivityInstance = list.get(0);
            String taskId2 = historicActivityInstance.getTaskId();
            List<HistoricDetail> formProperties = historyService.createHistoricDetailQuery()                  .processInstanceId(processInstanceId).taskId(taskId2).formProperties().list();
            for (HistoricDetail historicDetail : formProperties) {
               HistoricFormPropertyEntity historicFormPropertyEntity = (HistoricFormPropertyEntity) historicDetail;
               formParams.put(historicFormPropertyEntity.getPropertyId(), historicFormPropertyEntity.getPropertyValue());