1

I want to show custom field value in the contacts list of list manager Sitecore 9.3 enter image description here

FullName and Number are custom fields

2

By default, we can only see, First Name, Last Name and email facets values in List Manager view. To extend the contact list view to see custom facets instead of the default ones, you'll need to follow the below steps. I am assuming you've already created and deployed the custom model that wraps a custom facet, as described in this article

  1. Add a column for a custom facet to the Contacts table.
  • Switch to the Core database.
  • Add a new ColumnField item under the /sitecore/client/Applications/List Manager/Lists/Contact list item.
  • Fill out fields, EmptyText (sets a default text if a cell does not contain any data. HeaderText (a name of the column) and DataField (a name of the custom facet, used as a data source).
  • Save the changes. The new column then appears in the List Manager app, but without values.
  1. Create a custom contacts controller.
  • Create your custom ContactDataModel to contain all the required facets.
  • Data is mapped by the Sitecore.ListManagement.Services.Repositories.ListSubscriptionsStoreclass. Create your own class that has a GetSubscribers method returning IEnumerable of your custom model
  • The data is retrieved from _contactProvider and converted to the specified model using the MapEntity method. Next, inject the custom mapping logic in the MapEntity method.
  • The _contactProvider.GetFilteredContacts method returns only three facets (ListSubscriptions, Personal, Emails). So, add the custom ones to the list:
  • The default ListSubscriptionsStore is used by the Sitecore.ListManagement.Services.Controllers.ContactsController controller. Create your custom controller, which performs the same actions and changes the GetEntries method to use the custom ListSubscriptionsStore and Change the RoutePrefix attribute value of the controller to sitecore/api/customlists/{listId}/contacts
  1. Create a processor that registers your control:
    public class RegisterHttpRoutes
        {
            public void Process(PipelineArgs args)
            {
                GlobalConfiguration.Configure(Configure);
            }
     
            protected void Configure(HttpConfiguration configuration)
            {
                var routes = configuration.Routes;
                routes.MapHttpRoute("CustomContacts", "sitecore/api/customlists/{listId}/contacts", new
                {
                    controller = "CustomContacts",
                    action = "customaction", // Name of the action in ActionName attribute         
                });
            }
  1. Patch the RegisterHttpRoutes processor:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
      <sitecore>
        <pipelines>
          <initialize>
            <processor type="Namespace.RegisterHttpRoutes, AssemblyName"/>
          </initialize>
        </pipelines>
      </sitecore>
    </configuration>
  1. Open Core database in the Content Editor and navigate to the /sitecore/client/Applications/List Manager/Global Settings/ListTaskPageSettings/ContactsDataSource Parameters item. Change its URL field to /sitecore/api/customlists.

After performing all these steps, you can upload a CSV list containing custom facets.

You can find all the steps in detail and codebase at my blog post: https://sitecorewithraman.wordpress.com/2021/07/01/customize-list-manager-part-iii/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.