# Creating and managing custom templates

!!!info
A **Custom Template** is a fine-tuned selection of fields in your data so that you can see the exact fields in your record that you want to.
!!!

<div>
  <script async src="https://js.storylane.io/js/v2/storylane.js"></script>
  <div class="sl-embed" style="position:relative;padding-bottom:calc(46.19% + 25px);width:100%;height:0;transform:scale(1)">
    <iframe loading="lazy" class="sl-demo" src="https://app.storylane.io/demo/0ndcgvrtyiva?embed=inline" name="sl-embed" allow="fullscreen" allowfullscreen style="position:absolute;top:0;left:0;width:100%!important;height:100%!important;border:1px solid rgba(63,95,172,0.35);box-shadow: 0px 0px 18px rgba(26, 19, 72, 0.15);border-radius:10px;box-sizing:border-box;"></iframe>
  </div>
</div>

---

There are four controls for managing templates, to the right of the **Using Template dropdown**, which you will see when you are looking at an individual record.

- **Edit** allows you to edit the basic properties of the current template
- **Clone** makes a copy of the current template that can be edited
- **Delete** deletes the current template
- **Add** allows you to create a new template from scratch

When creating or editing a custom template, you should have a rich record open, of the type that you are creating a new template for. For eg, if you are creating a new object template, choose a rich object record with lots of data.

Editing an existing template or adding a new template brings up a pop-up. 

The basic properties of a new template are Title, Endpoint, and Rules.

- The **Title** is the name of your template as it will appear in lists.
- The default **endpoint** is ‘all endpoints’ and should only be changed if you need to restrict the template to a particular endpoint.
- The **rules** are entered in a further popup which requests two values: **Path** and **Match Pattern**.

For the **path**, you will typically choose **@datatype.base**. This can be found by typing an @ and using autocomplete.

For the **match pattern** you need to replace the text between the caret (^) and the dollar ($) in the text 

```
^match_this_value$
```

You will typically enter 

```
^object$
```
 for an item record or 

```
^agent$
```
for an organisational record 

and then click **Add**. If you’re familiar with regular expressions, you can use one here.

In the rules section of the lower popup you will then see a rule that looks something like

```
@datatype.base = ^object$
```
You can then choose either to **save** an empty template, or to **autogenerate** a template.
 
An **autogenerated template** looks at the data in all records of the current type (eg an agent) and creates a template best suited to display the data of the record that you have open. It might need some adjustment once it’s created.

An **empty template** allows you to add, structure and edit the appearance of the fields in your data from scratch.
