Skip to content

BPM: a stale action process variable overrides the button, so Approve completes as Reject in a submit→approve flow #6337

Description

@NicoleNG18

Describe the bug

In a process with two sequential action-setting user tasks (e.g. a submit task followed by an approve task), clicking Approve on the second task routes the workflow down the reject branch. The approve gateway ${action == 'approve'} evaluates false even though the user clicked Approve, so the record ends REJECTED and the approve-branch service tasks (status → APPROVED, the consume/rollup/posting delegates) never run. When both buttons are affected, the approver can never approve at all.

Root cause is two cooperating bugs in generated task-form code:

  1. The Harmonia task form preloads all process variables into the form model, including the BPMN control variable action (template-form-builder-harmonia/.../ui/form.js.template:130). The earlier submit task set action='submit', so the approve task's form opens with model.action === 'submit'.
  2. The completion handler spreads the model after the button's action (engine-intent .../generator/form/FormIntentGenerator.java:252, data: Object.assign({ action: action }, $scope.model || {})), so the stale model.action ('submit') overwrites the button's action ('approve'). The task completes with action='submit' → the approve gateway takes its default (reject) flow.

It only bites processes whose approval task is preceded by another action-setting user task; where the approve task is the first/only action task, model.action is undefined and the button value survives.

To Reproduce

  1. Publish a process with two sequential action-setting user tasks: submit (action submit) → capacity gate → approve (actions approve/reject) → approveDecision ${action == 'approve'} → activate(APPROVED)+consume, else reject.
  2. Create a vacation request and complete the submit task (sets action='submit').
  3. As the manager, open the approve task and click Approve.
  4. Observe the request becomes REJECTED: no VacationDay rows are created and VacationEntitlement.consumedDays never updates — the approve-branch service tasks never ran.

Expected behavior

Clicking Approve must complete the task with action='approve', so the approve gateway evaluates true and the approve-branch chain runs (status → APPROVED, plus the consume/rollup/posting delegates); Reject must complete with action='reject'. The button the user clicked must always determine the completion action — a stale action left over from an earlier task must never override it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions