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


## Overview

> Macro (excerpt)
> 
> Set state expiry duration

The **{set-state-expiry}** macro is used to add or replace the expiry date of the active workflow **[{state}](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649531575)**.

## Where to use it?

Optional.

One `{set-state-expiry}` can be put in a **[{trigger}](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649859133)**[ macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649859133).

## Parameters

| **Parameter** | **Required** | **Default** | **Notes** | **Ver** |
| --- | --- | --- | --- | --- |
| `duedate` | :check_mark: |  | Duration until state expiry:<br>- Format can be either:
    - Explicit date in the format: `YYYY-MM-DD HH:mm` (v4.12+)
    - ISO 8601 Duration Period
  - Supports [Value References](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302)
  - See [Expiry Dates](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649890606) for more information | 4.9 |

## Events

The following [Events](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655) are associated with state expiry:

- `stateexpired`

## Value references

The following [Event references](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649925434) are associated with state expiry:

- `@duedate@`
- `@expirydate@`

## Example

In this example, when the workflow transitions in to the `Start` state, it's expiry date will be set to a **P**eriod of **1 W**eek (`P1W`). Upon expiry, the workflow will transition to the `Stop` state.

```plaintext
{workflow:Expiry}
   {state:Stop|submit=Start}
   {state}
   {state:Start|expired=Stop}
   {state}
   {trigger:statechanged|state=Start}
      {set-state-expiry:duedate=P1W}
   {trigger}
{workflow}
```

## All examples

> Macro (contentbylabel)

## See also

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

- [Expiry Dates](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649890606)
- [States](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649595551)
- [Transitions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649563425)
- [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):

- [State expiry date](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649693610)