Saturday, 11 September 2021

Custom data source on Sitecore template field

 Actually there are many ways to apply data source on Template's Field, Rendering Item, Rendering data source Location and Rendering parameter. 

  • using sitecore data item path/id
  • using sitecore query/fast-query
above both - most used ways.

But there are many scenarios, where after applying data source path wanted final list after modified data by type, filtering, custom code logic or any dynamic logic on data source .


Custom class as data source
We can do this activity as well using custom class, and we can call them on 
 by setting data source Field value as

code:Sitecore.CustomDataSources.UpdateDataSource,Sitecore.CustomDataSources

custom-data-source-sitecore-template-field


PowerShell script as data source
There are also another way to do this using PowerShell script.

by setting data source value as 
script:/sitecore/system/Modules/PowerShell/Script Library/CustomDatasource

and place your PowerShell script at above location with File name as CustomDatasource



Hope this will help.

Friday, 27 August 2021

Sitecore dropdown fieldtype validation

In this article, we will try to achieve droplink's field validation. So to before start there is a concept that sitecore droplink actually store item's ID.

And to achieve this we have to apply validation on dropdown fields, just apply regex there as ^.{38}$. 



Please see below screenshot



Hope this will help.