We get the form key from task service likes following snipped code
for (Task task : getTaskService().createTaskQuery().taskCandidateGroupIn(candidateGroup).initializeFormKeys().list()) {
task.getFormKey()
....
....
...
}
but now for some special reason we wanna get the form key value from HistoricTaskInstance, and we try several ways to get it but all of them fail.
We are wondering that how we can get the form key value from completed task?
The form key is not available for historic tasks. Usually forms are not displayed for historic tasks since the tasks have been completed. If the task has not been completed (history contains both active and completed tasks), then you can use the id of the historic task to get the form key using the form service.
If the task has already been completed, then you need to use the model api to get the form key from the XML: