Activity instance for a task vs Task

Hello
I noticed that the engine creates both Activity instance for a task and a Task
they seem like different objects having different identifiers:

What would be the correct way to get the variables from the Task through the Rest api?

  1. To find the task searching by the activity instance id of the task
  2. and then to get the variables from the task?

Thanks in advance

Hello @jaxx ,

the usual way to do this is to query tasks with the given query parameters.
https://docs.camunda.org/manual/latest/reference/rest/task/get-query/

If you then have the task, you can find its variables with this endpoint:
https://docs.camunda.org/manual/latest/reference/rest/task/variables/get-task-variables/

Hope this helps

Jonathan

IMO the perplexion stems from the fact that one often means “task instance” when one says “task”. It’s like “process” vs. “process model”.

@fml2 ,
I am not really talking about the task description inside the process definition.
it seems that there are both task object (child of a given execution) and activity instance for a task

Hello @jaxx ,

I think taking a look at the database schema makes it clear:

https://docs.camunda.org/manual/7.15/user-guide/process-engine/database/database-schema/

Hope this helps

Jonathan

Hi @jonathan.lukas
Thank you for the link
However I still have trouble finding, which is the object/table behind the “activity instance”?

Hello @jaxx ,

in this case, that might help:

https://docs.camunda.org/manual/latest/user-guide/process-engine/process-engine-concepts/#activity-instances

Here, the concept of activity instances is described.

Jonathan

Yes , I read this , thank you
Are the activity instances stored in the DB (in the same way as tasks and executions)? I do not see them in the Database schema from your previous link?

Hello @jaxx ,

the activity instance itself is not an entity, as it can be different things (task, subprocess, …). But, when you look at the execution table for example, you can see that the activity instance id is referenced here.
Reason for this is that the activity instance represents the current state of the process instance and can be calculated at any time.

I hope this answers all your questions.

Jonathan

So the activity instance is something temporary, which is calculated on the fly? Something like a linking object?
What confused me - is that it has its own identifier - [task id from the definition xml] + [UUID]
and this is not the UUID of the Task or the UUID of the execution.
So I thought that it may correspond to a real “persistent” object in the DB.
But anyway, I do not really need to delve that deep in the internal implementation, it was more curiosity.

Thank you