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.

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 » 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 .
  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.

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.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?