# Related data custom field

## Overview

You use the *Related data* custom field to relate one content item to another. Then, you can make related items to be displayed as a link on the frontend.

> success **EXAMPLE**: You have a dynamic module *Authors*. The module stores information about different authors. Create a page where you drop the *Authors* widget. Open the *News* module and create a custom field of type *Related data* and *Data type* Authors. In the backend, when you create a news item, you see the custom field added. There you can choose an author that will be related to the news item. Then, you add the *Authors* field to the widget template of the *News* widget. When you open the site and click a news item, you will see the details of the news item and the link to the author’s details.

To add a *Related data* custom field, perform the following:

1. Perform procedure [Create custom fields](https://www.progress.com/documentation/sitefinity-cms/create-custom-fields) » *Step 1* to *Step 5*.
2. In *Data type* dropdown box, select the data type which you want to relate.\
   You can select dynamic data types, built-in data types, and pages.\
   For example, you can relate *Events* to *News* or *Pages*, or you can relate them to a dynamic type, created with the *Module builder*.
3. Click *Continue*.\
   The *Add a field* window appears.
4. In *Allow selecting items from...*, select the provider where you want to store the related media items.
5. Under *Interface widget for selecting items*, select the widget that you want to use in the backend to select the related item.\
   Depending on the data type, it can be a content or page selector.
6. In the *Label input* field enter the label of the selector.\
   This label is displayed when you create a content item in the backend.\
   For example, *Related items*.
7. In *Instructional text*, enter instructions or explanatory text for the custom field, if needed.\
   The text is displayed when the content editor clicks the question mark icon in the backend when editing the item containing this custom field.
8. Select the *This is a required field* checkbox, if you want to make the custom field mandatory.
9. Select the *Multiple items from this data type can be related* checkbox to enable the content editors to relate multiple items. Unchecking it limits the relationship to just one item.
10. Click *Done*.\
    The new field appears in *Custom fields* section.\
    If you want to delete a custom field, click ![](https://www.progress.com/documentation/sitefinity-cms/assets/b810e0c30dd0c81088194e02d6e65fb1/delete-trash.png "delete trash").
11. Save your changes.
12. Insert the custom field in the respective widget template.\
    For example, if you want to relate *News* to *Author*, you must insert the *Authors* custom field in the widget template that you use to display news items.\
    For more information, see [Create and edit widget templates](https://www.progress.com/documentation/sitefinity-cms/create-and-edit-widget-templates-mvc).

## Deleting an item with related data custom fields

When you delete an item that has related data custom field added to it, you can choose to display a warning message. This way, you can avoid breaking links from other content items or pages.

To do this, perform the following:

1. Click *Administration » Settings » Advanced*.
2. In the tree on the left, click *RelatedData* and select *Display a warning message to prevent users from deleting items that are related to another items* checkbox.
3. Save your changes.
