﻿---
title: Create case templates
description: Create YAML-defined case templates that pre-fill case defaults, field library values, connectors, and case settings.
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/7410/explore-analyze/cases/create-case-templates
products:
  - Elastic Cloud Serverless
  - Elastic Observability
  - Elastic Security
  - Kibana
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Planned
---

# Create case templates
Create a case template to pre-fill case defaults whenever your team opens a similar case. On the **Configuration** tab, you also set the template's identity, optional case settings, and an optional external connector. This guide shows you how to configure a template and author its YAML.

## Before you begin

- Your role must have the **Manage templates** sub-feature privilege for **Cases**. Refer to [Control access to cases](/elastic/docs-content/pull/7410/explore-analyze/cases/control-case-access#give-manage-templates-access).
- Review [what's in a template](/elastic/docs-content/pull/7410/explore-analyze/cases/manage-case-templates#case-templates-anatomy) and how it uses the [field library](/elastic/docs-content/pull/7410/explore-analyze/cases/manage-case-templates#case-templates-field-library).
- (Optional) [Create reusable fields](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/7410/explore-analyze/cases/create-case-field-library) that the template should include.


## Create a template

The template editor has a YAML pane and a preview pane with **Fields** and **Configuration** tabs:
- **Fields**: Define case defaults and custom fields in YAML, and preview how they render on a case. Changes in the preview sync back to the YAML.
- **Configuration**: Set the template's identity, case settings, and an optional external connector. These values aren't part of the YAML definition.

To create a template:
1. Find **Cases** using the [global search field](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/7410/explore-analyze/find-and-organize/find-apps-and-objects), then select **Templates** > **Create**.
   Cases are [scoped by solution](/elastic/docs-content/pull/7410/explore-analyze/cases/create-cases#cases-limitations). On Elastic Stack, search for `Security/Cases` or `Observability/Cases`, or go to **Stack Management** > **Cases**. On Serverless, search for `Cases` in Elastic Security or Observability.
2. On the **Fields** tab, define case defaults and the fields to pre-fill. [Add reusable fields from your field library](#case-templates-field-ref). Refer to the [YAML schema reference](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/7410/explore-analyze/cases/yaml-template-schema-reference) for supported keys.
3. On the **Configuration** tab, enter a template name. Optionally add a description, tags, case settings (**Sync alerts** and **Extract observables**), and an external connector.
   <note>
   **Extract observables** is available in Elastic Security only.
   </note>
4. Click **Create**. The template is enabled by default so it's available when creating a case.

As you edit, the editor validates your YAML and suggests values. While you're editing, your changes are saved as a draft so you don't lose your work. Select **Reset** to discard the draft and return to the last saved version.

### Add reusable fields from the library

Global fields appear on every case automatically, so you don't add them to a template. To include a reusable field, add it in the YAML on the **Fields** tab. Use `$ref` with the field's `name` (not its label). Use the `name` in YAML when you author templates. Use the field's `label` when you [search cases](/elastic/docs-content/pull/7410/explore-analyze/cases/search-share-cases#search-case-field-values).
For example, to add the `summary` field from the library:
```yaml
fields:
  - $ref: summary
```

A reference can also use a different name for that template, or override the field's default value, without changing the original field in the library:
```yaml
fields:
  - $ref: summary
    name: incident_summary
    metadata:
      default: A different default for this template
```


## What to do next with case templates

From here, you can use the template on cases and update it later if your workflow changes.
- [Create a case](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/7410/explore-analyze/cases/create-cases): Select a template to pre-fill fields when opening a case.
- [Apply a template to an existing case](/elastic/docs-content/pull/7410/explore-analyze/cases/manage-cases#apply-case-template): Update an open case with values from an enabled template.
- [Edit and share case templates](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/7410/explore-analyze/cases/edit-case-templates): Edit, clone, delete, or import and export templates.