---
title: "Select the workflow that is applied using content labels"
canonical: "https://support.appfire.com/space/CDML/650347842/Select%20the%20workflow%20that%20is%20applied%20using%20content%20labels"
format: markdown
---
> Macro (aura-html)


## Overview


> Macro (excerpt)
> 
> This is a way for space administrators to automatically apply workflows to different documents in a space based on the content label.

The example uses three active workflows in a space

- A **Workflow Selector** workflow that is applied to content in a space by default
- Two other workflows, each with a label content filter

This makes it easier for users to select the workflow to apply to a page without giving users the ability to customize the workflow.

## Workflow Selector workflow

The workflow applied by default to new content has an initial state that allows a user to select one of two workflows by choosing an appropriate state.

![image](media://eb91c6c8-c256-4e85-9c90-6174bc9e06d7)

There are two triggers, each listening for a `statechanged` event.

![image](media://8b9f18e9-9cb2-45e9-bcd5-3f4f7bd6f30f)

- The first trigger listens for the state change to the **Project One** state
- The second trigger listens for the state change to the **Project Two** state

Each trigger

- Adds a label to the content that is used to filter the workflow applied to the page
- Sets a state in the content filter workflow

The addition of the label causes the application of the appropriate label content filter workflow.

```plaintext
{workflow:name=Workflow Selector}
    {state:Select State for Workflow}
    {state}
    {state:Project One}
    {state}
    {state:Project Two}
    {state}
    {trigger:statechanged|state=Project One}
        {set-label:projectone}
        {set-state:Draft Project One}
    {trigger}
    {trigger:statechanged|state=Project Two}
        {set-label:projecttwo}
        {set-state:Draft Project Two}
    {trigger}   
{workflow}
```

## Project One workflow

The second workflow, **Project One, **has a content label filter `projectone`.

This workflow adds the label as a [stickylabels](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650217225).

Adding `stickylabels=true` <span style="color: #172b4d"> prevents labels from being removed except by a user with administrator permission.</span>

```plaintext
{workflow:name=Project One Workflow|label=projectone|stickylabels=projectone}
    {state:Draft Project One}
    {state}
    {state:Cheese}
    {state}
    {state:Bacon}
    {state}
{workflow}
```

## Project Two workflow

The third workflow, **Project Two, **has a content label filter `projecttwo`.

This workflow also adds the label as a [stickylabels](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650217225).

```plaintext
{workflow:name=Project Two Workflow|label=projecttwo|stickylabels=projecttwo}
    {state:Draft Project Two}
    {state}
    {state:Jam}
    {state}
    {state:Donut}
    {state}
{workflow}
```

## How it works

When you create a new page, the example **Workflow Selector** workflow is enabled and applied to the content.

![image](media://288e8bd1-32a1-4c02-9c24-78ab19d626e0)

Select a destination state using the workflow status dialog box.

![image](media://d0d21cc0-f6d0-4d32-a1cd-0201274c32a4)

Choosing the **Project One** state initiates the following trigger actions

- Sets the content label as `projectone`
- Sets the state to the** Draft Project One **state

The addition of the `projectone` label to the page applies the **Project One workflow.**

![image](media://e30492d1-e8e4-438b-88b6-8915f59d2976)

Choosing the **Project Two** state causes the workflow to add the `projecttwo` label.

![image](media://6980070d-ee11-4424-a5e7-4187dc746d7f)

The state is set to **Draft Project Two,** and the **Project Two workflow **is applied.

![image](media://54204b49-f74f-4367-927a-b920efc0c6a1)

> 📝 The initial states set in each content filter workflow can have the same name; states only need to be uniquely named in the same workflow.