---
title: "task macro"
canonical: "https://support.appfire.com/space/CDML/650315819/task%20macro"
format: markdown
---
> Macro (aura-html)


## Overview

> Macro (excerpt)
> 
> Add tasks to workflow states

The `task` macro is used to automatically create tasks when a workflow `state` is entered.

## Where to use it?

Optional.

One or more `task` macros can be put in a [state macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649531575).

Within a `state`, each `task` must be uniquely named.

> ℹ️ Tasks can be added for each workflow state using the **[Edit states panel](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650118713)** in workflow builder

## Parameters

| Parameter | Required | Default | Notes | Ver |
| --- | --- | --- | --- | --- |
| *unnamed first parameter*  
or `name` | :check_mark: |  | Name of task:<br>- Within any `state` macro, each `task` macro must have a unique name
- The name can use any character set supported by your Confluence server – except some [reserved characters](https://wiki.comalatech.com/display/CWND/Reserved+Characters). | 3.0+ |
| `assignee` |  |  | Task assignee:<br>- Username – must have edit permission on the associated content
- Supports [Value References](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302)<br>If no assignee specified, any user with edit permission on the associated content can assign or complete tasks.<br>> Macro (contentbylabel) | 3.0+ |
| `duedate` |  |  | Due date for task completion:<br>- Format can be either:
  - Explicit date in the format: `YYYY-MM-DD HH:mm` (v4.12+)
  - ISO 8601 Duration Period
  - See [Expiry Dates](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649890606) for more information
- Supports [Value References](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302)<br>If specified, the task, if not completed, will eventually expire and trigger a **[taskexpired](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655)**[ event](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655).<br>> Macro (contentbylabel) |  |
| `note` |  |  | Note to associate with the task:<br>- Plain text
- Can use any character set supported by your Confluence server – except some [reserved characters](https://wiki.comalatech.com/display/CWND/Reserved+Characters).
- Logged in activity report and sent in notifications<br>> Macro (contentbylabel) | 3.2.7+ |
| ## Deprecated<br>The following parameters are no longer supported. |
| `type` |  |  | [Obsolete] Task types are no longer supported – use {approval} macros instead, with [customised button labels](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649924300). | 3.0  
↓  
3.2 |

You can [add one or more workflow tasks](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650118713) to each state using the workflow builder:

![workflowbuilder_addtask_withassignee_duedate.png](media://97a3e8cf-c83a-4af8-9d58-98c4b45097ba)

Added tasks are listed in the state panel for the workflow state.

![workflowbuilder_statepanel_twotasks_details.png](media://ecad8761-151a-433e-87b1-395ac012808b)

## Tasks completed transition

A [state](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649531575) can be configured to automatically transition once all tasks are completed using its `completed` parameter.

You can add this transition using the workflow builder:

![workflowbuilder_transitionseditor_taskscompletedtransition.png](media://6b46535a-7b1d-411a-9ac8-3fc29e1849af)

## Events

The following [Events](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655) relate to tasks:

- `taskcreated`
- `taskassigned`
- `taskcompleted`
- `taskexpired`

## Example

```plaintext
{workflow:name=Task example}
   {state:Tasks|completed=Done}
      {task:Some task}
   {state}
   {state:Done}
   {state}
{workflow}
```

## All examples

> Macro (contentbylabel)

## See also

[Workflow Authoring Guide](https://appfire.atlassian.net/wiki/spaces/CDML/pages/648611901):

- [Tasks](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694408)
- [Expiry Dates](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649890606)
- [Events](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655)
- [Triggers](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649563178)
- [Actions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649858941)

[User Guide](https://appfire.atlassian.net/wiki/spaces/CDML/pages/648907144):

- [Workflow Status Bar](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650117676)
- [Tasks Popup](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649824290)

[Reporting Guide](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649070833):

- [Report on tasks](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649661358)