Validation Message in Sitecore Content Hub

Problem Statement:

Display the validation error message when the save button is clicked. While creating or updating entities in Sitecore Content Hub, we may have requirements to validate the author inputs based on a pre-defined condition, such as image extensions not being allowed except PNG and JPEG, checkboxes must be checked, or field values not being empty.

In this blog, I am taking an example of a validation message that triggers if a field value is empty.

sitecore-content-hub

Solution:

To implement this functionality, you need to perform the following steps:

Step 1: Create a Script, paste the following script, and check whether the field value is null or empty. You can modify it as per your requirements.

See the blog post to Create a Script, Action, and Trigger in Sitecore Content Hub.

Step 2: Create an Action and choose the above script.

Step 3: Create a Trigger and choose the execution type as “In process”. Select the condition using the respective entity type. Go to the Actions tab and choose Action under the Validation Action section:

validation-message-sc-ch-1

Step 4: Go to the Search page create a new entity and click on the save button without entering data in the Title field. You will get the validation message below:

validation-message-sc-ch-2 Happy Sitecoreing ðŸ˜Š

Comments

Popular posts from this blog

Sitecore Installation Error: Failed to Start Service 'Sitecore Marketing Automation Engine'

Import CSV Data in Sitecore Using PowerShell: Part-3

Sitecore : The database principal owns a schema in the database, and cannot be dropped message