I came across a weird requirement related to Sitecore MultiList field. Usually MultiList Field makes use of Item’s Display Name property and shows those values in the selection list.
Instead of Display Name, it is requested to display the value of the corresponding data source item’s particular field value. I didn’t get to know much about the background behind this requirement. But I always wanted to know about the behind screen functions of Sitecore and thought this might be a good opportunity to get my hands dirty as these would come in handy, later when I start working on SPEAK.
I searched for related articles and unfortunately I couldn’t find anything helpful. So, I decided to reverse engineer Sitecore’s OOTB MultiList Field and try to leverage that and modify the control of the existing MultiList field to match the requirement.
I also, thought it will be worth it to share the steps followed. I wanted it to be generic, so that rather than for this particular requirement, these steps can come in handy for a more general purpose. Aka like creating a custom control or extending the OOTB Sitecore Features. Exploring how the OOTB features work – to a more granular level.
So started looking into existing MultiList field’s Control, the related configs and finally after decompiling the related Sitecore DLL…Voilà!!
Existing MultiList Field’s Control Source,
- All the information about existing field types will be available in Core DB. In our case, /sitecore/system/Field types/List Types/Multilist.
![system
Aliases
Dictionary
Field types
Analytics
Simple Types
List Types
Checklist
Droplist
Grouped Droplink
Grouped Droplist
Lookup Name Lookup Value
G Multilist
Multilist with Search
G MultilistDisp1ayTitle
Multiroot Treelist
Name Lookup Value List
Name Value List
Item path:
Template:
Created from:
Item owner:
'sitecoreJsystern/FieId types/ List Types/MuItiIist
,'sitecoreJtemp1ates/SFtemrremplatesrremplate field type - 17D6A-11
[unknown)
sitecor&dmin
Assembly ghared):
Class [shared]:
content:MuItiIistEx](https://pushpaganan.home.blog/wp-content/uploads/2020/01/image-15.png?w=1024)
The related configs,
Via showconfig.aspx,
After decompiling the related DLL and traversing to the corresponding class. Courtesy JustDecompile.
Now we could clearly see by default it’s using the relative item’s Display Name while showing in the selection list. Now instead of the Item’s Display Name we need to show the Item’s particular field value.
This can be done by creating a new MultiList Field based on the OOTB MultiList and update it’s Control Source with custom Control Source.
Create a new field based on MultiList field – MultiListDisplayTitle

Now, we will create a custom Control using existing MultiList field control and include our changes.
For creating a custom control, we should extend Sitecore.Web.UI.HtmlControls.Control and must override DoRender(HtmlTextWriter output) method that will be called by default when this particular field is rendered in Sitecore.
For the time being I am just replacing the Display Name with the Item’s Field Name in the OOTB MultiListEx class and using it . For the demo purpose, I am making use of a field name – Author Name.

Now, we will include this class’s assembly name, namespace etc and configure a patch. I have added custom as the prefix.

And final step, update this control in the newly created MultiListDisplayTitle field

Created a new template with both MultiList and MultiListDisplayTitle field, both having same data source. The Data Source, I gave here has children having the field named Author Name.

Below, you can see MultiListDisplayTitle displaying the field Author Name value in the selection list and MultiList displaying the DisplayName in the selection list.

This MultiListDisplayTitle can be used in the code base similar to MultiList field.