Migration - field type text list, multiple values

Created on 18 June 2025, 24 days ago

Problem/Motivation

Attempting to find examples or an explanation of how to properly export a text list field of values from a content type into a data file. Like exporting the multiple values for a given field list as a single comma separated list for the field in the CSV.

The practical example is:
Content Type: office
Field: field_office_states
Type: text field - list
Lists 50 states and 1 ALL value.

Samples of exporting are:
state = "OR, WA, DC"

In the database the text field type list doesn't capture the multiple values as a single record for the node NID. Rather it creates individual records for each relationship.

entity_id, field_office_states_value
1, "OR"
1, "WA"
1, "DC"

Schema Example:
Table Name: node_field_state
Field: bundle
Field: deleted
Field: entity_id
Field: revision_id
Field: langcode
Field: delta
Field: field_office_states_value

Migration Config Ideas?

id: migrate_office
label: Migrating Offices

source:
  plugin: 'csv'
  path: 'path_to_data_file/data-export.csv'
  delimiter: ','
  enclosure: '"'
  header_offset: 0
  fields:
     - 
       name: id
       label: 'NID'
     - 
       name: title
       label: 'Title'
     - 
       name: states
       label: 'States'
   ids: [id]

process:
      nid:
          - 
            plugin: get
            source: id
         - 
            plugin: default_value
            default_value: null
      title:
           plugin: service
           service: transliteration
           method: transliterate
           unpack_source: false
           source: title

      langcode:
           plugin: default_value
           default_value: 'en'
      type:
           plugin: default_value
           default_value: office
       uid:
           plugin: default_value
           default_value: 1
destination:
    plugin: 'entity:node'
    default_bundle: office

Pattern attempts:
Intended to go between the title and langcode fields.
Try one:

πŸ’¬ Support request
Status

Active

Version

11.1 πŸ”₯

Component

migration system

Created by

πŸ‡ΊπŸ‡ΈUnited States emptyvoid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024