> For the complete documentation index, see [llms.txt](https://documentation.2pintsoftware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.2pintsoftware.com/deployr/customization/creating-a-step-definition.md).

# Creating a Step Definition

Step definitions let you create reusable steps. They can be quite simple or very complex, depending on your requirements. Several elements, called **types**, can be added to a step definition to provide flexibility.

### Step Option Fields

When creating an option, you can configure several fields that control different aspects of the step definition.

* Name
* Display name
* Description
* Required
* Type
* Default Value
* Add validation
* Hidden

#### Name

This is the option's name. It is important because DeployR creates a task sequence variable based on this value. For example, if you name the field `textbox`, the task sequence will contain a variable named `textbox`. Its value will be whatever the administrator enters in the task sequence editor when adding this step definition.

#### Display name

This is the friendly name displayed in the task sequence editor. It helps the administrator understand what to enter or select in the value field.

#### Description

This text appears in a tooltip and provides additional instructions for the administrator using the step.

#### Required

Tells the task sequence editor whether the administrator must provide a value for this option. This is helpful when requiring an admin to choose from a drop-down list or to add specific information for your task sequence to run correctly.

#### Type

Choose the type of input to collect from the admin. Additional settings for the chosen type appear in the lower section.

#### Default Value

This is helpful when a variable is usually set to a specific value. This allows the step definition to be preset to a value, which is based on the type chosen earlier. This field is required when using the script type.

#### Add validation

When using text fields, you can add regex rules to ensure the admin puts in data that will not break the process later. For example, if collecting a URL from the admin, a regex rule can check for http or https in the text string.

#### Hidden

This property tells the task sequence editor if this option will be visible for the admin to see. Often, when a script runs behind the scenes, the script option is hidden, which keeps the UI clean for the admin.

### Available Types

* Text
* Large Text
* Number
* Boolean
* Script
* Content
* Content List
* Drop Down
* Task sequence

#### Text

When information is required from the end user, a text type can be used. The text will be returned to the step as a STRING and can be used in tandem with the script type which could consume that information.

#### Large Text

Similar to Text but allows for a larger block to be added.

#### Number

Allows a number to be entered.

#### Boolean

Creates a check box. If checked, it returns true; if unchecked, it returns false.

#### Script

There are two ways in which you can use the script type. When you click "Add option", the "Add step option" dialog appears:

* For embedding a script, set the NAME property to script, then paste in your script as the default value
* For running a script from a content item, set the NAME property to scriptName, and set the name of the script in your content item as the default value
  * make sure that your script is associated with a content item. The step logic will automatically look for a script with the name you set in the default value in a content item labeled "content"

{% hint style="info" %}
In your overall step definition, do not have more than one **script** type option.
{% endhint %}

#### Content

Provides files to your step definitions; most commonly used for scripts, JSON files, etc.

#### Content List

#### Drop Down

Allows the creation of items and values, helping to prevent user error when setting up the step.

#### Task sequence

Calls a task sequence from the step definition.

### Step Definition in the UI

This is not a real step definition and would not work. It is just an example to show all of the options and what they look like in the UI. Real samples are in the subpages.

#### As shown under Step Definitions:

<figure><img src="https://content.gitbook.com/content/8m0VARX9oyZ2zXWCdPgr/blobs/S4lmvNNyKznR0Q13no0Y/image.png" alt=""><figcaption></figcaption></figure>

As shown in a task sequence that it was added to:

<figure><img src="https://content.gitbook.com/content/8m0VARX9oyZ2zXWCdPgr/blobs/uS9M4402WQMhW7KQlgCb/%7BF5313DC2-95F1-4A1D-8EC1-5C8E5A007B3C%7D.png" alt=""><figcaption></figcaption></figure>

Pro tip: look at some of the built-in step definitions to see how they work. If they include scripts and content items, you can look into those as well.

The subpages have some production examples of how step definitions can be created and used.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://documentation.2pintsoftware.com/deployr/customization/creating-a-step-definition.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
