# User tasks and variables passed in complete method

**URL:** <https://forum.camunda.io/t/user-tasks-and-variables-passed-in-complete-method/59658>\
**Category:** Camunda 7 Topics\
**Created:** [February 11, 2025, 10:35pm UTC](https://forum.camunda.io/t/user-tasks-and-variables-passed-in-complete-method/59658 "2025-02-11T22:35:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cristian](https://forum.camunda.io/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@Cristian](https://forum.camunda.io/u/Cristian)\
**Post date:** [February 11, 2025, 10:35pm UTC](https://forum.camunda.io/t/user-tasks-and-variables-passed-in-complete-method/59658/1 "2025-02-11T22:35:49Z")

</div>

When one calls “void complete(String taskId, Map\<String, Object\> variables);” method from TaskService interface, do those variables get applied as global to process instance? Or…?

As context, here’s a diagram of an imaginary process:

 ![image](https://forum.camunda.io/uploads/default/original/3X/2/7/2798f6bd79df13cf32eb537b376c8d31d7380260.png)

User task “Confirm Item Processed Info” is within a subprocess (of a multi-instance subprocess called “Inner Handling”) called Item Inner Handling. I made it more complicated than necessary on purpose in order to test something else. (Of course, the inner handling could have been absent here.)

The “Confirmed” variable used in Confirmed gateway is coming from this user task. Should I pass it in the complete method of user task? Should I rather set it to the parent execution as a local variable?

Can you comment, please?

Cheers!

---

<div class="post-metadata">

**Author:** ![hassang](https://forum.camunda.io/user_avatar/forum.camunda.io/hassang/32/16498_2.png) [@hassang](https://forum.camunda.io/u/hassang)\
**Post date:** [February 12, 2025, 5:07am UTC](https://forum.camunda.io/t/user-tasks-and-variables-passed-in-complete-method/59658/2 "2025-02-12T05:07:45Z")

</div>

> [@Cristian](#):
>
> When one calls “void complete(String taskId, Map\<String, Object\> variables);” method from TaskService interface, do those variables get applied as global to process instance? Or…?

It is context-based.

The **Confirmed** variable should be defined within the appropriate scope—either as a local variable tied to the specific instance of the multi-instance sub-process “item handling” or as a local variable within the inner sub-process “item inner handling”. This can be easily managed using the input mechanism.

Yes, the **Confirmed** variable is intended to be set via the `complete` method.

---

<div class="post-metadata">

**Author:** ![Cristian](https://forum.camunda.io/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@Cristian](https://forum.camunda.io/u/Cristian)\
**Post date:** [February 12, 2025, 4:01pm UTC](https://forum.camunda.io/t/user-tasks-and-variables-passed-in-complete-method/59658/3 "2025-02-12T16:01:06Z")

</div>

Thanks much. Am I correct to assume that complete method will set the passed in **Confirmed** variable value on the first scope it encounters while bubbling up which contains a variable with that name and if none found, it will set it to global process instance scope?

---

<div class="post-metadata">

**Author:** ![hassang](https://forum.camunda.io/user_avatar/forum.camunda.io/hassang/32/16498_2.png) [@hassang](https://forum.camunda.io/u/hassang)\
**Post date:** [February 12, 2025, 4:02pm UTC](https://forum.camunda.io/t/user-tasks-and-variables-passed-in-complete-method/59658/4 "2025-02-12T16:02:49Z")

</div>

That is correct 👌

---

<div class="post-metadata">

**Author:** ![Cristian](https://forum.camunda.io/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@Cristian](https://forum.camunda.io/u/Cristian)\
**Post date:** [February 12, 2025, 4:12pm UTC](https://forum.camunda.io/t/user-tasks-and-variables-passed-in-complete-method/59658/5 "2025-02-12T16:12:37Z")

</div>

@hassang Thanks very much for all your kind and prompt help provided to me over the last 1-2 weeks!

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [February 19, 2025, 4:13pm UTC](https://forum.camunda.io/t/user-tasks-and-variables-passed-in-complete-method/59658/6 "2025-02-19T16:13:13Z")

</div>

Closed on February 19, 2025, 4:13pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
