---
title: "Element <task>"
source: https://dev.pageseeder.com/api/elements/element_task.html
description: "API Element reference for <task>"
last_updated: 2026-08-07T17:09:54+10:00
tokens: ~966
---

# \<task\>

## Summary

A [task](../../reference/glossary/task.md) is created by adding a [status](../../reference/glossary/status.md) to a discussion. It can also have a priority, a due date, and can be assigned to one group member.

The `<task>` element extends the `<discussion>` element to include attributes (`@status`, `@priority` and `@due`) and an element (`<assignedto>`).

## Usage context

| Permitted content | `<comment> <group> <locator> <uri> <assignedto>` |
| --- | --- |
| Permitted parent | `<tasks>` |

## Attributes

This element defines the following attributes:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| due | `xs:dateTime` | no | When the task is due |
| id | `xs:long` | yes | The ID of the task |
| lastcommentdate | `xs:dateTime` | no | The date of the last comment |
| lastcommentid | `xs:long` | no | The ID of the last comment |
| priority | `xs:string` | no | The priority of the task |
| replycount | `xs:int` | no | The number of replies in the thread |
| status | `xs:string` | yes | The status of the task |
| title | `xs:string` | no | The title of the task (250 char) |

> **Note:** All the task attributes are generated from the comments. With the exception of the `@id` attribute, every new comment added to the discussion thread (each reply) can update the attribute values.

Attributes inherited from `<discussion>` element are documented here.

### `@due`

This optional attribute indicates the date and time the task is due, it is computed as the latest value that has been set on a comment in the discussion thread. Any new comment in the thread can update the value.

### `@priority`

This optional attribute indicates the priority of the task, it is computed as the latest value that has been set on a comment in the discussion thread. Any new comment in the thread can update the value.

For possible values of the `@priority` attribute, *see* the [attributes of the \<comment\> element](element_comment.md).

#### `@status`

This required attribute indicates the status of the task and is always present. It is computed as the latest value that has been set on a comment in the discussion thread. Any new comment can update this value.

## Examples

## Schema

### XML Schema

```lang-relax

<xs:element name="task" type="task"/>

<xs:complexType name="task">
  <xs:sequence>
    <xs:choice minOccurs="0">
      <xs:element name="group"     type="group-basic" />
      <xs:sequence>
        <xs:element name="uri"     type="uri" />
        <xs:element name="locator" type="locator"    minOccurs="0" />
      </xs:sequence>
    </xs:choice>
    <xs:element name="assignedto"  type="assignedto" minOccurs="0"/>
    <xs:element name="comment"     type="comment"    minOccurs="0"
                maxOccurs="unbounded"/>
  </xs:sequence>
  <xs:attribute name="due"             type="xs:dateTime"/>
  <xs:attribute name="id"              type="id" use="required"/>
  <xs:attribute name="lastcommentdate" type="xs:dateTime"/>
  <xs:attribute name="lastcommentid"   type="id"/>
  <xs:attribute name="priority"        type="xs:string"/>
  <xs:attribute name="replycount"      type="xs:positiveInteger"/>
  <xs:attribute name="status"          type="xs:string" use="required"/>
  <xs:attribute name="title"           type="comment-title"/>
</xs:complexType>
```

### Relax Schema

```lang-relax

element task {
   attribute due             { xs:dateTime }?,
   attribute id              { xs:long },
   attribute lastcommentdate { xs:dateTime }?, 
   attribute lastcommentid   { xs:long }?, 
   attribute priority        { text }?,
   attribute replycount      { xs:boolean }?,
   attribute status          { text },
   attribute title           {  text { maxLength = "250"} }?,
   group? 
   uri?
   locator?
   assignedto?
   comment*
}
```

## Compatibility

No change since initial API release.

