I see someone else had this issue https://forums.activiti.org/content/access-activitiformkey-using-activiti-rest-version-513 I've had a look at the mappings and handlers and traced them to database layer. The problem seems to be the formKey is not persisted to ACT_RU_TASK, in fact quite a few fields I'd expect in REST call responses seem not to be present for the same reason they don't seem to make it from the visual editor or process definition bpmn xml to the database.
I've been looking activiti-bpmn-* modules for the code responsible for actually storing the formKey in ACT_RU_TASK but so far haven't found it. Maybe someone can shed some light on this issue?
The TaskEntityImpl in MybatisTaskDataManager(AbstractDataManager<EntityImpl>).insert(EntityImpl) line: 78 seems to contain the same missing values including formKey as are missing from the database ACT_RU_TASK
I'm trying to find where the parameters are assembled for the task insert … but it's difficult to trace execution through a command pattern arch. org.activiti.engine.impl.agenda.ContinueProcessOperation - Executing activityBehavior class org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior
seems to trigger org.activiti.engine.impl.persistence.entity.TaskEntityImpl.insertTask through an event I'm guessing … but I can't seem to find the calling code and therefore where the parameters are assembled for the task insert … ?
Ok it looks like this is a bug in activiti-app, this problem doesn't seem to occur in a test case loading a resource direct from an bmpn20.xml file, because the formKey is there in the UserTask flowElement in the list in Process object. But in activity-app the the bmpn20.xml persisted as a blob to ACT_GE_BYTEARRAY omits the formKey. Inside it seems to be there earlier as in the json-converter seems to work and the bpmn-converter, it must get dropped before it's persisted to ACT_GE_BYTEARRAY
The bug can be found in com.activiti.service.runtime.DeploymentServiceImpl.retrieveFinalFormKey(String, FlowElement, Map<Long, Form>, AbstractModel, Long, Long, User)