Showing posts from August, 2021

Sitecore Content Hub - Custom Trigger/Action to clean an Asset's title

Today I want to show you how easy it is to modify the properties of an asset using a custom Trigger/Action. In this specific scenario, we are going to clean the asset's title to follow certain naming conventions when the asset is created. The naming conventions that we are going to enforce are:  1. Replace empty spaces with hyphens  2. Replace underscores with hyphens  3. Remove special characters  4. Use only lowercase letters 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.Sdk; using System.Net; using System.Net.Http; using System.Text; using Newtonsoft.Json; using System.IO; using System.Text.RegularExpressions; var assetLoadConfiguration = new EntityLoadConfiguration() { PropertyLoadOption = new PropertyLoadOption("Title"), RelationLoadOption = RelationLoadOption.None, CultureLoadOption = CultureLoadOption.Default }; var assetI