I have a plugin which creates a task every time a specify form is submited. Now I want to create a WrapperTask and run each of those tasks as a subTask:

Craft Task with running sub tasks

I know that I can create a sub-task within the WrapperTask by using $this->runSubTask, but how can I add a subTask to an already running WrapperTask from outside (the service for example)? Or at least send a new settings-array to an already running Task?


  1. User submits form
  2. Service creates WrapperTask
  3. Service adds subTask to WrapperTask
  4. Nothing happens for some time
  5. User submits form again
  6. Service checks if WrapperTask is still running, and adds subTask


If that's not possible, can I at least show them visually as subtasks of my plugin in the task-list?

  • 1
    I rolled you over 2k. :-)
    – nicael
    Jun 26, 2014 at 22:12
  • Suggesting to read about your new privilege
    – nicael
    Jun 26, 2014 at 22:17

1 Answer 1


Sub-tasks can only be initiated by the parent task, and they will only visually look like a sub-task if they are actually sub-tasks.

It’s also not possible to change the settings of an already-running task, at least without manually checking for new settings in your task.

So, your parent task’s getStep() function would need to do its own checking to see if it should be running a sub-task, somehow, and then conditionally call $this->runSubTask().

  • Sorry..., I think my question was confusing (note-to-self: never ask questions when tired). I hope it's clearer now, could you take a look again? Thanks a lot. :)
    – Victor
    Jun 26, 2014 at 12:58
  • Got it. Just updated my answer. Jun 26, 2014 at 19:17
  • Thanks. But is it possible to pass data to a running task? Or would I need to use a Record and check on each run?
    – Victor
    Jun 26, 2014 at 19:19
  • @VictorIn Updated once again. Jun 26, 2014 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.