Add a Related data custom field

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

EXAMPLE: You have a dynamic module Authors. The module will store information about different authors. Create a page where you drop the Authors widget. Open the News module and created 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 » 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. In Source, select the provider where you want to store the related media items.
  4. Click Continue.
  5. Under Interface widget for uploading or 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 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. 
  8. Select the This is a required field checkbox, if you want to make the custom field mandatory.
  9. Under Display selected items on the frontend using..., select the widget that you want to use to display the selected data type on the frontend of your site.
    By default, the Simple link widget is used to display related items. When you click the link, the system take you to the default page for displaying the related data type. For more information, see Locations of content items: Canonical URLs.
    For example, if you are creating a custom field for the News module that is data type Authors. The link to the author will be displayed with each news item. When you click it, the system takes you to the default page for displaying authors.

    You can also use the built-in widget of the content type for which you are creating the custom data field.
    For example, if you are a custom field for the News module that is data type Authors, you can use the News widget to display the authors.

  10. In Label input field enter the label of the link that will be displayed on the frontend.
    For example, See authors details.
  11. Click Done.
    The new field appears in Custom fields section.
    If you want to delete a custom field, click .
  12. Click Save changes.
  13. 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.

NOTE: 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.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?