Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prev_work_item does not resolve as expected in dynamic tasks #2241

Open
StephanH90 opened this issue Jun 26, 2024 · 0 comments
Open

prev_work_item does not resolve as expected in dynamic tasks #2241

StephanH90 opened this issue Jun 26, 2024 · 0 comments

Comments

@StephanH90
Copy link
Contributor

When you have multiple dynamic tasks after a task/flow like this:

{
    "model": "caluma_workflow.task",
    "pk": "my-regular-task",
    "fields": {
      "type": "complete_task_form",
      "form": "a-form"
    }
  },
{
    "model": "caluma_workflow.taskflow",
    "pk": "...",
    "fields": {
      "task": "my-regular-task"
    }
  },
{
    "model": "caluma_workflow.flow",
    "pk": "some pk",
    "fields": {
      "next": "['my-first-dynamic-task', 'my-second-dynamic-task']|tasks"
    }
  },

and you have these dynamic tasks:

@register_dynamic_task("my-first-dynamic-task")
    def resolve_dynamic_task_1(self, case, user, prev_work_item, context):
        # here prev_work_item refers to the "my-regular-task" work item

@register_dynamic_task("my-second-dynamic-task")
    def resolve_dynamic_task_2(self, case, user, prev_work_item, context):
        # here prev_work_item refers to the "my-first-dynamic-task" work item  <<<<------ is this intended?

For me, this seems counterintuitive. I wouldn't expect the order of the tasks in the next to matter, since they are being opened in parallel anyway. I would assume that prev_work_item should in both cases refer to the work item that belongs to the my-regular-task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant