Task Variables with in Sub Process

I am using tasklist and using Embedded Taskforms. I have a process model which has multiinstance subprocess with multiple user tasks. I am trying to fetch the variables for a task in one of the instance in the sub process. I am using the below method to query.

Using the below API i am fetching the subprocess activityinstances.
http://localhost:8081/rest/history/activity-instance?processInstanceId=8f7d8dc1-1d84-11ea-894c-005056b47730&activityId=SystemReviewSubProcess

From the result of the above query, using the execution id i am trying to query the tasks associated with each instances of the subprocess using the below API.
http://localhost:8081/rest/history/task?executionId=cddf66b3-1d84-11ea-894c-005056b47730

Using the executionId from the above API result, i am trying to query the variable instances.
http://localhost:8081/rest/history/variable-instance?processInstanceId=8f7d8dc1-1d84-11ea-894c-005056b47730&executionIdIn=cddf66b3-1d84-11ea-894c-005056b47730

What i found from the result is that the taskId value is null for all the variables that were created from the UI, whereas the taskId is present for the variables that were created using TaskListener or executionListener.

Because of this i am not able to segregate the variables associated for a given task. Please advise how to fetch the variables (including Local variables) associated with the given task.

Hi @ChandruM,

Form SDK works as follow

  • As long as you don’t have the variable defined in any scope then when form is submitted the variable would be created in the process instance scope.

  • If you have a variable with the same name defined in multiple scopes then the variable in the most child scope would be the one fetched from the backend and it also would be the one updated when the form is submitted.

  • Keep in mind that form fields are process instance variables