Output Mappings Generate Historic Variable Update Entry with broken Activity Instance ID?


#1

Hi

@thorben hoping you can give some insight into the underlying logic here, or if this is a bug?

Working with Historical queries and when Activities use Output mappings, we are trying to link the Historic Variable history with the activities that the variable events occurred on:

When you perform a HistoricDetailQuery, you get all of the variable update instances such as HistoricDetailVariableInstanceUpdateEntity.

HistoricDetailVariableInstanceUpdateEntity is the entity that has the history of the variable update. When you create a variable in a script, it generates the Activity Instance Detail + The Variable Instance Update Entity.

BUT, when you generate a variable using a Output Mapping, only a HistoricDetailVariableInstanceUpdateEntity is created, and the ActivityInstanceId property of the HistoricDetailVariableInstanceUpdateEntity does not actually map back to the Activity.

Example:

HistoricDetailVariableInstanceUpdateEntity[variableName=userVar, variableInstanceId=15, revision=0, serializerName=null, longValue=null, doubleValue=null, textValue=userVal, textValue2=null, byteArrayId=null, activityInstanceId=Task_0xjkfyv:13, eventType=null, executionId=9, id=16, processDefinitionId=9, processInstanceId=9, taskId=null, timestamp=Tue Apr 16 10:37:36 EDT 2019]

HistoricVariableInstanceEntity[id=15, processDefinitionKey=CallActivityCoverageScript, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, taskId=null, executionId=9, tenantId=null, activityInstanceId=9, caseDefinitionKey=null, caseDefinitionId=null, caseInstanceId=null, caseExecutionId=null, name=userVar, revision=0, serializerName=string, longValue=null, doubleValue=null, textValue=userVal, textValue2=null, state=CREATED, byteArrayId=null]

**Generated with Output Mapping** --> HistoricDetailVariableInstanceUpdateEntity[variableName=userTask, variableInstanceId=17, revision=0, serializerName=null, longValue=null, doubleValue=null, textValue=test, textValue2=null, byteArrayId=null, activityInstanceId=9, eventType=null, executionId=9, id=18, processDefinitionId=9, processInstanceId=9, taskId=null, timestamp=Tue Apr 16 10:37:36 EDT 2019]

HistoricVariableInstanceEntity[id=17, processDefinitionKey=CallActivityCoverageScript, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, taskId=null, executionId=9, tenantId=null, activityInstanceId=9, caseDefinitionKey=null, caseDefinitionId=null, caseInstanceId=null, caseExecutionId=null, name=userTask, revision=0, serializerName=string, longValue=null, doubleValue=null, textValue=test, textValue2=null, state=CREATED, byteArrayId=null]

**Generated with Output Mapping** --> HistoricDetailVariableInstanceUpdateEntity[variableName=dog, variableInstanceId=22, revision=0, serializerName=null, longValue=null, doubleValue=null, textValue=test, textValue2=null, byteArrayId=null, activityInstanceId=9, eventType=null, executionId=9, id=23, processDefinitionId=9, processInstanceId=9, taskId=null, timestamp=Tue Apr 16 10:37:36 EDT 2019]

HistoricVariableInstanceEntity[id=22, processDefinitionKey=CallActivityCoverageScript, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, taskId=null, executionId=9, tenantId=null, activityInstanceId=9, caseDefinitionKey=null, caseDefinitionId=null, caseInstanceId=null, caseExecutionId=null, name=dog, revision=0, serializerName=string, longValue=null, doubleValue=null, textValue=test, textValue2=null, state=CREATED, byteArrayId=null]


HistoricActivityInstanceEntity[activityId=SequenceFlow_179y264, activityName=null, activityType=sequenceFlow, activityInstanceId=null, activityInstanceState=0, parentActivityInstanceId=null, calledProcessInstanceId=null, calledCaseInstanceId=null, taskId=null, taskAssignee=null, durationInMillis=0, startTime=Tue Apr 16 10:37:35 EDT 2019, endTime=Tue Apr 16 10:37:35 EDT 2019, eventType=null, executionId=9, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, tenantId=null]
HistoricActivityInstanceEntity[activityId=SequenceFlow_1m292zv, activityName=null, activityType=sequenceFlow, activityInstanceId=null, activityInstanceState=0, parentActivityInstanceId=null, calledProcessInstanceId=null, calledCaseInstanceId=null, taskId=null, taskAssignee=null, durationInMillis=0, startTime=Tue Apr 16 10:37:36 EDT 2019, endTime=Tue Apr 16 10:37:36 EDT 2019, eventType=null, executionId=9, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, tenantId=null]
HistoricActivityInstanceEntity[activityId=SequenceFlow_09js0pl, activityName=null, activityType=sequenceFlow, activityInstanceId=null, activityInstanceState=0, parentActivityInstanceId=null, calledProcessInstanceId=null, calledCaseInstanceId=null, taskId=null, taskAssignee=null, durationInMillis=0, startTime=Tue Apr 16 10:37:36 EDT 2019, endTime=Tue Apr 16 10:37:36 EDT 2019, eventType=null, executionId=9, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, tenantId=null]
HistoricActivityInstanceEntity[activityId=StartEvent_1, activityName=Start, activityType=startEvent, activityInstanceId=null, activityInstanceState=4, parentActivityInstanceId=9, calledProcessInstanceId=null, calledCaseInstanceId=null, taskId=null, taskAssignee=null, durationInMillis=10, startTime=Tue Apr 16 10:37:34 EDT 2019, endTime=Tue Apr 16 10:37:34 EDT 2019, eventType=null, executionId=9, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, tenantId=null]
HistoricActivityInstanceEntity[activityId=Task_0xjkfyv, activityName=User 1, activityType=userTask, activityInstanceId=null, activityInstanceState=4, parentActivityInstanceId=9, calledProcessInstanceId=null, calledCaseInstanceId=null, taskId=14, taskAssignee=null, durationInMillis=169, startTime=Tue Apr 16 10:37:35 EDT 2019, endTime=Tue Apr 16 10:37:36 EDT 2019, eventType=null, executionId=12, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, tenantId=null]
HistoricActivityInstanceEntity[activityId=Task_19wlini, activityName=Do 3, activityType=scriptTask, activityInstanceId=null, activityInstanceState=4, parentActivityInstanceId=9, calledProcessInstanceId=null, calledCaseInstanceId=null, taskId=null, taskAssignee=null, durationInMillis=61, startTime=Tue Apr 16 10:37:36 EDT 2019, endTime=Tue Apr 16 10:37:36 EDT 2019, eventType=null, executionId=20, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, tenantId=null]
HistoricActivityInstanceEntity[activityId=Task_1rrwivw, activityName=User 2, activityType=userTask, activityInstanceId=null, activityInstanceState=0, parentActivityInstanceId=9, calledProcessInstanceId=null, calledCaseInstanceId=null, taskId=26, taskAssignee=null, durationInMillis=null, startTime=Tue Apr 16 10:37:36 EDT 2019, endTime=null, eventType=null, executionId=9, processDefinitionId=CallActivityCoverageScript:1:7, processInstanceId=9, tenantId=null]

In the above example,

HistoricDetailVariableInstanceUpdateEntity[variableName=dog, variableInstanceId=22, revision=0, serializerName=null, longValue=null, doubleValue=null, textValue=test, textValue2=null, byteArrayId=null, activityInstanceId=9, eventType=null, executionId=9, id=23, processDefinitionId=9, processInstanceId=9, taskId=null, timestamp=Tue Apr 16 10:37:36 EDT 2019]

It has a ActivityInstanceId of 9, but there is not ActivityInstanceId, and they all share the same ParentActivityInstanceId…

What is the explanation for this behavior?

Generally you can map a variable update (such as from a execution of a script) back to the specific activity instance. But for a Output mapping, the data mapping appears to be different?


#2

Anyone from @Camunda able to provide some insight on this? Want to get this fixed up in the coverage generator code for: https://github.com/DigitalState/camunda-coverage-generation. As it’s currently breaking coverage generation when output mappings are used.


#3

@Niall any insight on this? Its a blocker to update the code coverage generation app