Process Variable Consistency Across Parallel Flows and Exception Handling in Appian

Certified Senior Developer

Hi all,

 

I have a question about process variables behavior in parallel flows and exception handling.

 

Scenario:

- The parent process has a process variable (pv!x) initialized with value = 5.

- The process splits into two parallel branches.

- Both branches start with pv!x = 5.

 

Then:

- Branch A continues execution, updates pv!x, and reaches the merge point.

- The parent process continues and later updates pv!x = 6.

- Meanwhile, Branch B is still active and waiting in a task (for example, a user input or a task with an exception flow handling an error).

 

Question:

Will Branch B see the updated value (pv!x = 6) while it is still in that task/exception state, or will it continue working with the original value (pv!x = 5) that was evaluated when the branch started?

 

In other words:

Are process variables dynamically re-evaluated for already running parallel activities, or do they keep the value from the moment the activity started?

 

Thanks in advance!

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Branch B will see pv!x = 6.
    Process variables are shared across the entire process instance - not scoped per branch. When any branch (or node) updates a PV, the change is immediately visible to all other active branches, including Branch B, even if it's mid-task or in an exception flow.
    PVs are global to the process instance.

  • 0
    Certified Lead Developer

    What exactly do you mean with "branch" and "parent process"? Is this about a single model with a AND or XOR flow?

  • 0
    Certified Lead Developer

    Within a single process model, process variables (PVs) are global in scope. So, if Branch A updates pv!x to 6, then Branch B will see pv!x = 6, assuming the update has already occurred, because both branches are working on the same shared process state.

    However, when you introduce a subprocess (child process) in a branch, the behavior is different. At the moment the subprocess starts, it receives a copy of the process variable values from the parent.
    If pv!x is still 5 at that time, the subprocess will receive 5, even if the parent updates pv!x to 6 later.

    Therefore, subprocess interactions behave like pass-by-value, not pass-by-reference. Because:
    The child process receives a snapshot of the data at invocation time and It does not automatically see future updates made in the parent process.

  • 0
    Certified Lead Developer

    When the flow reaches the user input task in Branch B, depending on whether pv!x was already updated in Branch A or not the value passed to task node will vary. 
    1. If pv!x is updated to 6 before user input task started then branch B will pass 6 to the task

    2. If pv!x was not updated to 6 and user input task starts in Branch B then 5 will be passed to the task.

    3. In both the cases however as soon as branch A updates the pv!x to 6 Branch B will see the updated value as the variable referenced is the common and not a copy or reference. 

    Overall in terms of value passed to task depends in timing of the flow in parallel. But in process at any point of time or Branch, pv will hold one value only - 5 or 6! Child nodes can have older or newer value depending on the sequence they occur.