In Sitecore Content Hub, definitions act as blueprints for entities, providing structure and context for the various types of content you manage. It allow you to model business entities such as assets, contracts, products, etc., and extend metadata by customizing out-of-the-box entities or introducing entirely new ones. They help organize content by enabling entities to have their own relationships, properties, and constraints. While Sitecore Content Hub provides core definitions like "M.Asset", "M.Collection" and "M.Content" out-of-the-box, you can extend these existing definitions or create new ones based on your project’s specific requirements. This technical guide walks through the process of creating new definitions and explains the scenarios where it’s necessary to create them.
Why and When to Create New Definitions
When to Create a New Definition
There are several reasons you may need to create a new definition:
- Custom Business Entities: When your business requires managing entities that aren't covered by default definitions (e.g., contracts, marketing campaigns, or legal documents).
- Unique Metadata Structure: When the standard definition’s fields don't adequately capture the unique metadata or attributes required for the new content type.
- Custom Workflows and Behavior: When certain business logic, like custom workflows or automation, applies only to a new type of entity that requires different properties, statuses, and relationships.
- Taxonomy and Categorization: When a unique classification or organization structure needs to be applied to a set of entities that don't align with the default asset or content types.
Why Create a New Definition
- Scalability and Flexibility: A new definition allows you to scale your data model without overloading existing definitions with non-relevant fields.
- Simplified Data Management: Definitions help keep your data organized, making content easier to manage and query.
- Enhanced Reporting and Insights: By separating data into new definitions, you can gain more detailed reporting and insights on specific entity types.
Practical Use Case: Managing Marketing Campaigns
Let’s walk through a real-world example of creating a new definition for Marketing Campaigns. In this use case, we will build a custom definition that allows your organization to track marketing campaigns with attributes like CampaignName, StartDate, EndDate, Location, MarketingAssets and CampaignStatusActive.
Scenario:
Your organization runs multiple marketing campaigns, each tied to various media assets such as images and videos. You need a way to track essential campaign details like its name, schedule, location, and assets. To achieve this, you'll create a custom definition for Marketing Campaigns in Sitecore Content Hub. This definition will include fields for CampaignName, StartDate, EndDate, Location, MarketingAssets, and CampaignStatusActive, allowing your team to efficiently manage and monitor each campaign’s progress and associated assets within the platform.
Step-by-Step Guide to Creating a New Definition
Let’s dive into the process of creating the new MarketingCampaign definition:
- Log in to your Sitecore Content Hub instance, navigate to Manage, then search for Schema. Click on Schema, and you’ll see an interface similar to this. Next, click on New Definition and name your definition MarketingCampaign.
- Now, create a new group called "Core Details", where you will add fields such as CampaignName (String), StartDate (DateTime), EndDate (DateTime), and Location (currently set as a String, though it can be created as a Taxonomy). The MarketingAssets field will be a Many-to-Many Relation, and CampaignStatusActive is set as a Boolean.
- Finally, click on "Apply Changes" to save the fields in the newly created group.
- Now, let's create a new page for the entity MarketingCampaigns, along with a subpage named New Marketing Campaign.
- On the MarketingCampaigns page, add a Creation Component and make it visible. Click on the Creation Component, go to General, select Custom for the button, create a translation, and assign a label to the button.
- Next, in the Creation Component, navigate to New Entities, choose the MarketingCampaign definition, and again select Custom for the button, providing a label through translations. Set the Detail Page and select Large Modal for the window size.
- On the New Marketing Campaign page, add an Entity Details Component, then click on it and configure it for the MarketingCampaign definition. Under Members, select Core Details, enable the Hide Group Label toggle, and review the other settings in the Settings tab.
- Now, go back to the MarketingCampaign page and click on View Page. You should now see the page with the added Creation Component and button. Click on New Marketing Campaign, and a pop-up with the defined properties will open.
- For now, I've added a few marketing campaigns. To quickly view all entities created through this definition, navigate to Manage -> Entities. In the Entities section, search for the MarketingCampaign definition. You’ll see all entities created with this definition. To view full entity details, click on View Detail.