<p>The description you define in <code>getDescription()</code> is just the default description in the event that no description was specified when <code>craft()-&gt;tasks-&gt;createTask()</code> was called.</p>

<p>The <em>actual</em> description for the task is saved on the TaskModel, which you can get via <code>$this-&gt;model</code> from your Task class:</p>

<pre><code>$description = $this-&gt;model-&gt;description;
</code></pre>

CC BY-SA 3.0
2014-07-16T22:52:35.923Z
2014-07-16T22:52:35.923Z
Brandon Kelly
<p>I know that I can get the default description of a Task with:</p>

<pre class="lang-php prettyprint-override"><code>$this-&gt;description;
//or
$this-&gt;getDescription();
</code></pre>

<p>But how can I get the description if it got changed on creation:</p>

<pre class="lang-php prettyprint-override"><code>craft()-&gt;tasks-&gt;createTask('Mailer', $new_description);
</code></pre>

<p>Adding it as an attribute doesn't seem "right" to me:</p>

<pre class="lang-php prettyprint-override"><code>craft()-&gt;tasks-&gt;createTask('Mailer', $new_description, array('description' =&gt; $new_description));
</code></pre>

<plugin-development><tasks>
How to get a Task's description inside runStep()?
# How to get a Task's description inside runStep()?

(Asked by: username_0 on 2014-07-16)

I know that I can get the default description of a Task with:
$this->description;
//or
$this->getDescription();

But how can I get the description if it got changed on creation:
craft()->tasks->createTask('Mailer', $new_description);

Adding it as an attribute doesn't seem "right" to me:
craft()->tasks->createTask('Mailer', $new_description, array('description' => $new_description));

**Tags:** plugin-development, tasks

---

## 1 answers

### Answer by username_1 on 2014-07-16. Score: 3 | Accepted answer

The description you define in getDescription() is just the default description in the event that no description was specified when craft()->tasks->createTask() was called.
The actual description for the task is saved on the TaskModel, which you can get via $this->model from your Task class:
$description = $this->model->description;


---

