Implement a converter for a custom value mapping set

Current version: 4.0

In Data Exchange Framework, Sitecore items are only used for configuration. When a data synchronization process runs, the configuration is read from the Sitecore items and then converted into framework components.

Get template item ID

To link the converter to the custom value mapping set template, you must locate and copy the template item ID.

To do this:

  1. In the Content Editor, navigate to /sitecore/templates/Data Exchange/Framework/Data Access/Mapping/Custom Value Mapping Set.

  2. Click the Content tab.

  3. In the Quick Info section, copy the Item ID value.

    Quick Info section on the Content tab, showing the Item ID value.

Implement custom converter class

You need a custom converter to transform the Sitecore item representing the custom value mapping set into an instance of your custom value mapping set type.

To implement the class:

  • In Visual Studio, add the following class:

    RequestResponse
    using Sitecore.DataExchange;
    using Sitecore.DataExchange.Attributes;
    using Sitecore.DataExchange.Converters;
    using Sitecore.DataExchange.Repositories;
    using Sitecore.Services.Core.Model;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace Examples.DataExchange
    {
        [SupportedIds("{00000000-0000-0000-0000-000000000000}")]
        public class CustomMappingSetConverter : BaseItemModelConverter<CustomMappingSet>
        {
            public CustomMappingSetConverter(IItemModelRepository repository) : base(repository)
            {
            }
            private static CustomMappingSet _instance = new CustomMappingSet();
            protected override ConvertResult<CustomMappingSet> ConvertSupportedItem(ItemModel source)
            {
                return ConvertResult<CustomMappingSet>.PositiveResult(_instance);
            }
        }
    }
Note

In the attribute SupportedIds, use the template item ID you copied in the previous step.

Deploy custom components

To deploy the code to your Sitecore server:

  1. Build the Visual Studio project.

  2. Copy the Examples.DataExchange.dll file to your Sitecore server.

Do you have some feedback for us?

If you have suggestions for improving this article,