0

I'm trying to migrate a CSV file of taxonomies (cities) into Drupal 8. The CSV has a code and the city name, for example:

City_Code,"Name"
1234,"CITY A"
5678,"CITY B"

I have the following as my current migration, which is working, and importing the city names. My problem is I also added a field with the machine name field_legacy_id to my term (Drupal 8), which I would like to populate with the OLD City_Code for reference later.

langcode: en
status: true
dependencies: {  }
id: cities
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: null
migration_group: null
label: 'My Import'
source:
  plugin: csv
  path: /path/to/data.csv
  delimiter: ','
  enclosure: '"'
  header_row_count: 1
  keys:
    - City_Code
  column_names:
    0:
      City_Cd: City_Code
    1:
      Name: Name
process:
  vid:
    plugin: default_value
    default_value: city
  name: Name
  field_leagcy_id: City_Code
destination:
  plugin: 'entity:taxonomy_term'
migration_dependencies: null

The field_legacy_id seems to be ignored and I can't figure out how to get the migration to populate the field value. Thanks.

Edit: This is the field attached to the taxonomy.vocabulary.city:

langcode: en
status: true
dependencies:
  config:
    - field.storage.taxonomy_term.field_legacy_id
    - taxonomy.vocabulary.city
id: taxonomy_term.city.field_legacy_id
field_name: field_legacy_id
entity_type: taxonomy_term
bundle: city
label: legacy_id
description: ''
required: false
translatable: false
default_value: {  }
default_value_callback: ''
settings:
  min: null
  max: null
  prefix: ''
  suffix: ''
field_type: integer
0

Looks like the field name is misspelled?

  field_leagcy_id: City_Code

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.