---
title: "Creating state flows"
slug: "creating-state-flows"
abstract: "Best practices to follow when creating and adapting state flows."
---
# Creating state flows

This section lists the best practices recommended for state flows. These are provided as tips and guidance, rather than complete instructions.

- First, consider all possible processes required to review a product. If certain product types require a distinct flow, you need to create a new state flow that triggers only for those product types.
- Always display the full state flow on the product details page, for a better user experience.
- Change the [master layout](https://doc.sitecore.com/ch/en/users/content-hub/use-a-master-layout.html "Use a master layout") of product details pages to display a [state machine viewer](https://doc.sitecore.com/ch/en/users/content-hub/statemachine-viewer.html "StateMachine viewer") and an [entity details](https://doc.sitecore.com/ch/en/users/content-hub/entity-details.html "Entity details") component that shows state flow-specific properties, such as assignee.
- If the reviewer group is different for each product, use [dynamic user groups](https://doc.sitecore.com/ch/en/users/content-hub/dynamic-assignees.html "Dynamic assignees").

> [!note]
> For detailed instructions for configuring page components, see [Page components](https://doc.sitecore.com/ch/en/users/content-hub/page-components.html "Page components")

## Adapt a state flow to specific content types

Different content types might need different state flows. For instance, technical marketing content might need a different review flow than corporate marketing content.

To adapt a state flow to specific content types:

1. If your flow is not related to a built-in content type, [create a new content type](https://doc.sitecore.com/ch/en/users/content-hub/content-types.html "Content types").
2. [Create](https://doc.sitecore.com/ch/en/users/content-hub/create-a-state-flow.html "Create a state flow") or [edit](https://doc.sitecore.com/ch/en/users/content-hub/state-flows.html "State flows") a state flow.
3. Create an action of **Type** *Start state machine* to start the new state flow.
4. Create then [configure](https://doc.sitecore.com/ch/en/developers/cloud-dev/triggers.html) a trigger with *Entity creation* and *Entity modification* as **Objective**.
5. Set a trigger condition to apply the new state flow to specific content types. Make sure to set a condition to *not* trigger the default CMP content approval for these specific content types.
6. Add the new action as a trigger action of **Type** *Post*.

## Create a product review flow

A commonly used state flow is the product review state flow. The following procedure demonstrates best practices for creating and adapting one.

To create a product review state flow:

1. [Create taxonomy values](https://doc.sitecore.com/ch/en/users/content-hub/create-a-taxonomy.html "Create a taxonomy") for the built-in *M.PCM.ProductStatus* taxonomy. Typical statuses are: *Created*, *Under review*, *Rejected*, *Approved*, and *Archived*.
2. Configure [security rules](https://doc.sitecore.com/ch/en/users/content-hub/user-group-policies.html "User group policies") for each product status. That means that you should define which user groups have permissions to read, update, or delete products, depending on their state. For example, a user group can read *Created* and *Under Review* products, while another group can only read *Approved* products.
3. [Create the initial state flow](https://doc.sitecore.com/ch/en/users/content-hub/create-a-state-flow.html "Create a state flow") that will represent your company's product review process.
4. [Assign user groups](https://doc.sitecore.com/ch/en/users/content-hub/configure-a-user-group-policy.html "Configure a user group policy") to each state.
5. Assign the users you want to take part in this state flow to the *M.Builtin.SM.Everyone* user group, which provides access to state flow actions and components.
6. Create an action of **Type** *Start state machine* that starts the product review state flow.
7. Change the [master layout](https://doc.sitecore.com/ch/en/users/content-hub/use-a-master-layout.html "Use a master layout") of all product details pages to display a [state machine viewer](https://doc.sitecore.com/ch/en/users/content-hub/statemachine-viewer.html "StateMachine viewer") and the state flow actions.
8. Create and [configure](https://doc.sitecore.com/ch/en/developers/cloud-dev/triggers.html) a trigger with *Entity creation* as the **Objective** and *In process* as the **Execution type**.
9. Add the new action as a trigger action of **Type** *Post*.

## Create a template review flow for Publisher

You can use state flows to review smart print templates for Sitecore Content Publisher. This example uses the taxonomy name *Chili.Publication.Status*.

To create a review flow for Sitecore Content Publisher templates:

1. [Create a taxonomy](https://doc.sitecore.com/ch/en/users/content-hub/create-a-taxonomy.html "Create a taxonomy") for the template life cycle, containing the values *Created*, *In review*, *Rejected*, and *Approved*. Call it *Chili.Publication.Status*, and assign a unique color to each taxonomy value.
2. [Create a relation](https://doc.sitecore.com/ch/en/users/content-hub/create-a-member.html "Create a member") between the life cycle taxonomy and the *M.Chili.Publication* schema definition called, for example, *StatusToChiliPublication*.
3. [Create](https://doc.sitecore.com/ch/en/users/content-hub/create-a-state-flow.html "Create a state flow") and [enable](https://doc.sitecore.com/ch/en/users/content-hub/enable-state-flows.html "Enable state flows") a template review state flow that reflects the template review process at your company, called, for example, *M.Chili.Publication*.
4. Assign the users who participate in this state flow to the *M.Builtin.SM.Everyone* user group, which provides access to state flow actions and components.
5. Create a user group for Sitecore Content Publisher administrators. Because upload packages and actions for editing templates are only visible to *M.Builtin.Chili.Administrators*, if you need a reviewer group with extended permissions such as review or edit, you need to define it in a new user group called, for example, *Chili.SuperAdmin* and assign the following permissions:
    - *Chili.Publication.Status* with *In Review* status: *Read*, *Update*, *DownloadOriginal*, *DownloadPreview*, and *ViewNotWatermarked*.
    - *Chili.Publication.Status* with *Approved* status: *Update* and *Delete*.
    - *Chili.Publication.Status* with *Created* or *Rejected* status: *Read*, *Update*, *Delete*, *DownloadOriginal*, *DownloadPreview*, and *ViewNotWatermarked*.
    - *Portal.Page: Annotation detail*: *Read*.
    - *Chili.Publication.Status*: *Read*.
6. Update the *M.Builtin.Chili.Everyone* user group to give it *Read* permission for *Approved* templates.
7. [Assign user groups](https://doc.sitecore.com/ch/en/users/content-hub/configure-a-user-group-policy.html "Configure a user group policy") to each state.
8. Create an action of **Type** *Start state machine* that starts the template review state flow.
9. Create and [configure](https://doc.sitecore.com/ch/en/developers/cloud-dev/triggers.html) a trigger with *Entity creation* as **Objective** and *In process* as **Execution type**.
10. Set a condition to trigger the template review flow when the state is *Created*, then add the new action as a trigger action of **Type** *Post*.
11. Enable and display the template review flow on all relevant pages:

    | Page | To do |
    | --- | --- |
    | Template details page | <ul><li>Add state flow actions and a [state machine viewer](https://doc.sitecore.com/ch/en/users/content-hub/statemachine-viewer.html).</li><li>Update the **Creation** component to assign the *Created* publication status at creation.</li><li>Update the **Details** component to disable the state flow properties.</li></ul> |
    | Template creation page | <ul><li>Update the **Details** component to disable the state flow properties.</li></ul> |
    | Template search page | <ul><li>Update the output settings to show the publication status as a badge based on the color of the taxonomy.</li><li>Add a horizontal facet to filter based on *Chili.Publication.Status*.</li></ul> |