Posts

Showing posts from September, 2021

Sitecore Content Hub - Custom Action/Trigger to assign Asset Types automatically

Image
Assigning Asset Types is usually a manual task that is performed when an asset is created. However, we can define some rules so that the Asset Types are automatically assigned based on a condition. Today I want to show you how easy it is to accomplish this by using a custom Trigger/Action. This is something we can define for types of assets that are continuously uploaded to Content Hub. In my specific scenario, I want to automatically assign the Asset Type depending on keywords existing on the file name as follow: 1. If the file name contains the "sow" keyword, assign the SOWs Asset Type 2. If the file name contains the "contract" keyword, assign the Contracts Asset Type The first thing we need to do is create our custom  Script :   The code we are going to use in this script is the following:  using Stylelabs.M.Base.Querying; using Stylelabs.M.Base.Querying.Linq; using Stylelabs.M.Framework.Essentials.LoadOptions; using Stylelabs.M.Sdk; using Stylelab