0

Sitecore 9.0.2, DEF 2.0.1

As part of my data import, I need to bring in a Status column that contains two possible values:

  • Active
  • Inactive

I want to represent these as a checkbox field in Sitecore, but I can't figure out how to convert them.

I found this question from an older version of DEF, but the interface for IValueReaders has changed requires a different return value for the conversion process.

Is there an easy way to accomplish this?

1

There is actually a built-in value reader for this: the Description to Code Value Reader. It works by defining a set of code definitions which map a "code" (int) to a "description" (string). To use it:

Create your code definition set and code definitions

  1. In your Data Exchange tenant under the Tenant Settings/Common folder, add a new Code Definition Sets Root folder
    • Template Path: /sitecore/templates/Data Exchange/Framework/Code Definitions/Code Definition Sets Root
    • Template ID: {88A5FB53-E56B-404F-BA17-8F55013A03CC}
  2. Add a Code Definition Set to that folder
  3. Add Code Definitions to the Code Definition Set
    • Active
      • Item Name: Active
      • Value: 1
    • Inactive
      • Item Name: Inactive
      • Value: 0

Add the value reader and use it

  1. In your Data Exchange tenant under the Data Access/Value Readers/Common folder, add a new Description to Code Value Reader
  2. In the Code Definition Set field, select your recently-created Code Definition Set
  3. In the Value Mapping item for the field, set the Source Value Transformer field to your new value reader

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.