---
title: Creating custom action workflow steps
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

> **Info:** **Kentico EMS required**
>
> Features described on this page require the **Kentico EMS** license.

Kentico enables you to write your own actions that you will be able to incorporate into a workflow process. The procedure consists of two steps – writing the code of the action and registering the action into the system.

## Writing actions

1. Create a new class and make it inherit from _CMS.DocumentEngine.DocumentWorkflowAction_.
2. Override the _Execute()_ method from the base class.
3. Write the code that you want to be executed with the action into the _Execute_ method's body.

Action steps can have parameters (settings) specified that you can use to modify their behavior. You can then enter the parameter's values when configuring an action step in the workflow designer.

If you want your custom action step to rely on parameters, you can specify them on the **Actions** of the **Workflows** application. To access the parameter's values in the code of an action, use the _GetResolvedParameter_ method.

To access the data of the page that will go through the action step, use the _Node_ object and its properties.

> **Note:** If you are creating the class in the **App\_Code** folder (or **Old\_App\_Code** on web application installations), add the **RegisterCustomClass** assembly attribute to register the class.
>
> See [Loading custom classes from App\_Code](https://docs.kentico.com/k11/custom-development/loading-custom-classes-from-app_code.md) for more information.

```csharp

using System;

using CMS;
using CMS.DocumentEngine;
using CMS.Membership;

public class CustomAction : DocumentWorkflowAction
{
    public override void Execute()
    {
        // Gets the parameter value or assigns a default value - an empty string
        string appendText = GetResolvedParameter("MyParameter", "");

        // Appends the parameter value to the name of the page
        Node.DocumentName += appendText;

        // Saves the changes into the database
        TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
        DocumentHelper.UpdateDocument(Node, tree);

    }
}

```

## Registering actions in the system

1. Open the **Workflows** application.
2. Select the **Actions** tab.
3. Click **New action**.
4. Fill in the following mandatory fields:
   - **Display name** - name of the action step.
   - **Action provider - Assembly name** - name of the library that contains the action's code. Select _(custom classes)_ for classes in App\_Code.
   - **Action provider - Class** - full name of the class that contains the action's code.
5. Click **Save**.
6. (Optional) Define the action's parameters on the **Parameters** tab.
