Why is TASK_ID_ column always null in act_hi_detail table?

Hi @AakankshaTej,

This field is only populated when the variable is defined in the scope of a task instance, i.e. it is a task-local variable. Typically (also when you complete a task), variables are created in a higher scope, for example the process instance execution. See the following link for more on variable scopes: https://docs.camunda.org/manual/7.9/user-guide/process-engine/variables/#variable-scopes-and-variable-visibility

In order to identify to which task a variable update belongs, you can use the field activityInstanceId of a historic detail, which corresponds to the id when you fetch historic activity instances.

Cheers,
Thorben

1 Like