Sub Process User Task Execution Issue

Hi,

If there are any subprocess, how can we make the task as complete, since it’ll create new process instance key for sub process, how can we get the task details?

For my usecase, I’ll be calling an API call which has process instance id, using process instance ID, I’m taking Active task details using Operate API, and using that I’ll get the task ID and get the task details from task list.

Process instance ID is sent when process instance is created for the workflow.

But in case of sub process, we cant use parent process instance ID to perfrom operation.

In case of Camunda 7 business key can be used, which will be same for parent and sub process.

Hi,
The subprocess should have a propertie called parentkey containing the process instance ID of the parent process (Operate API):

HI @StephanHaarmann , My use case if bit different here.
I have one API which takes the businesskey for user task to completed, using business key I’ll take the current active task and I’ll mark the task as complete.(In case of sub process also business key will be same, so it’ll work).

In C8, since there is no business key, I need to rely on process instance key, so when workflow process instance gets started, I’ll return the process instance ket so for all the user tasks one API is used which gets the Process instance key to get the active tasks and completed tasks and mark the task complete.

If sub process has a user task and I can use parent process instance key to perform operation. When Sub process is created by camunda, even though it’ll have parent process details, my application is not aware of this, and all the API calls will happen based on parent process instance key.

I believe that this requires multiple API request currently:

  1. You could search for a business key variable. You will receive all instances of this variable across all process instances
  2. Given the process IDs you can search for open tasks
  3. You can complete the task via the tasklist API.

Hi @StephanHaarmann, Currently I’m not storing businessKey variable.
Could you please help in how I can fetch the variables, from zeebeClient I dont see an option to fetch the variables.

Hi @Naveen_KS,

This functionality is not offered by Zeebe. Therefore, it is not included in the Zeebe client.

  1. You can use Operate API to search for variables (i.e., with a certain name and value). This will also give you the process instance Key.
    Operate API (REST) | Camunda Platform 8 Docs
  2. Afterward, you can use the Tasklist API to query for tasks of the respective process instances.
    tasks | Camunda Platform 8 Docs
    Task | Camunda Platform 8 Docs