---
title: "Create a decision template"
slug: "create-a-decision-template"
abstract: "Create decision templates in Sitecore Personalize to configure logic without code, using real-time data and facilitating inter-decision communication."
---
# Create a decision template

A decision template is a programmable decision that you configure and make available to other users on the decision palette.

You can optionally create a form for the decision template. When the marketer adds the decision template to the decision canvas, the form displays for the marketer to complete. This enables the marketer to configure decision logic without having to write or edit code.

When you create a decision template, you can use any real-time data made available by a service known as the guest context service.

To reference the output of the decision in other decisions, you must create an output reference. An output reference is a name that you save to the decision template. This makes it easy to pass the result of a decision as input in another decision. For example, you can enable a user to pass the result of the Retrieve Upcoming Orders Decision Template to a decision table that determines the next best offer.

Team members with a *User*, *Developer*, or *Admin* role in Sitecore Cloud Portal can create a decision template.

To create a decision template:

1. On the navigation menu, click **Developer Center** > **Decision templates**.
2. On the **Decision Templates** page, click **Create**.
3. In the **Name your Template** field, enter an intuitive name for the decision template. As you type, the name of the template displays in the **ID** field.
4. Click **Create**. The template editor displays for you to customize using JavaScript.

    > [!note]
    > Sitecore CDP automatically populates the name of the decision template in the output reference field. The user will see the name of the output reference display as helper text when configuring it as an input in another decision.

5. Click the **Settings** tab in the right name to edit the name that displays in the **Output Reference** field. Use the following syntax when naming the output reference:
    - The name must not contain spaces.
    - The first character must either be an ASCII letter (either uppercase or lowercase), a letter that complies with Unicode variable naming conventions, or an underscore (_) character. Do not use a number as your first character.
    - Subsequent characters must be letters, numbers, or underscores (_).
    - Do not use a reserved word. A reserved word is a keyword that is reserved by JavaScript functions or other uses that cannot be used as identifiers such as variable names, function names, and class names.
6. In the **Type** drop-down list, select one of the following return types:
    - **String** - a text value.
    - **Boolean** - a binary value that can either be true or false.
    - **Integer** - a number value.
    - **Long** - an integer that is longer than the size of the standard Integer type. This is useful for large numbers.
    - **Date** - represents a date value.
    - **List** - returns an array for use in a single output reference.
    - **Map** - returns the entire object for the next decision to use.
7. In the **JavaScript** tab, write the code for the decision template using [Immediately Invoked Function Expression](https://en.wikipedia.org/wiki/Immediately_invoked_function_expression) (IIFE). As you write your JavaScript, ensure that you consider the [data limits in decisioning](https://doc.sitecore.com/personalize/en/users/sitecore-personalize/using-server-side-javascript-in-sitecore-personalize/understanding-data-limits-in-decisioning-and-conditions.html "Understanding data limits in decisioning and conditions"). To automatically format and indent the JavaScript code, click ![Format JS icon](https://doc.sitecore.com/api/markdown-image/personalize/en/users/sitecore-personalize/images/preetify.png).

    > [!tip]
    > You can [create a form](https://doc.sitecore.com/personalize/en/users/sitecore-personalize/developer-center/decision-templates/create-a-decision-template/create-a-form-for-a-decision-template.html "Create a form for a decision template") so your colleagues can further configure the decision without ever having to write, edit, or view code.

8. Click **Save**.
9. When you are ready to make the decision template available to the marketer, click the toggle switch to [change the status](https://doc.sitecore.com/personalize/en/users/sitecore-personalize/developer-center/decision-templates/publish-a-decision-template.html "Publish a decision template") to the *Published* state. The template then displays on the decision palette for the marketer to drag-and-drop onto the decision canvas.