cancel
Showing results for 
Search instead for 
Did you mean: 

Business key not available from Task

arc
Champ in-the-making
Champ in-the-making
I think that the Business Key concept is good. It makes it possible to have an Activity process instance refer to e.g. an external database entry where the process instance's business data is stored. But to be able to use this we need to get hold of the business key from Task. I think it is a strange that you cannot get hold of the business key directly from the Task but have to make a query for the process instance. Since finding a Task already includes a database query it would be nice if that query also got hold of the business key of the process instance.

Shall I file a Jira new feature request? By the way, it seems like codehaus is closing down.
6 REPLIES 6

jbarrez
Star Contributor
Star Contributor
Querying for tasks with a business key is already possible: taskQuery.processInstanceBusinessKey(myKey)

Codehaus is indeed going down. We moved to https://activiti.atlassian.net/secure/Dashboard.jspa

arc
Champ in-the-making
Champ in-the-making
Ok, maybe I was a bit unclear. I mean that it would be nice get hold of the business key from Task objects returned from a task query when you haven't made the query with processInstanceBusinessKey().

We make a query for all tasks belonging to a specific assignee and the query returns a list of tasks (List<Task>). But we cannot get the business keys from the Tasks in the list.

jbarrez
Star Contributor
Star Contributor
No, that is true. The business key is not copied to task entities currently.
Might be a good addition though, although I don't yet clearly see the use case, except for being able to fetch the related date for the business key straight away?

pau
Champ in-the-making
Champ in-the-making
Hi,

I have the same need as the OP. From the task, I would like to fetch some data that it's in another DB, identified with the process business key. It would be useful to have it directly from the task.

A work around could be to add the business key as a process variable (which are available from the task). But I think it would be clearer (and probably faster) if the business key would be directly accessible in the Task.

arc
Champ in-the-making
Champ in-the-making
Yes, we've solved it by storing the business key both in the process instance and in the variables. But we would prefer to get the business key from the task and remove it from the variables.

love07ing
Champ in-the-making
Champ in-the-making
I had a similar problem, I have a need for a process instance task corresponds to a businessKey.
From a business point of view to this may be closer to the actual situation appropriate.
I do not know whether it is reasonable Activiti, and if there are appropriate solutions.