Select the workflow that is applied using content labels
Overview
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.
There are two triggers, each listening for a statechanged event.
- 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.
{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.
Adding stickylabels=true  prevents labels from being removed except by a user with administrator permission.
{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.
{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.
Select a destination state using the workflow status dialog box.
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.
Choosing the Project Two state causes the workflow to add the projecttwo label.
The state is set to Draft Project Two, and the Project Two workflow is applied.
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.
Need support? Create a request with our support team.
