Migrating into a multi-value nested custom field I have a nested field called released with three values


By
When


A node can have multiple releases. However, in the old dataset (d7), each node only had one release and the fields just a part of the node.

I want to now migrate it to the new format in d8

If it was just one value, I could do this

released/by: field_released_by
released/when: field_released_at


I tried the solution at https://www.freelock.com/blog/john-locke/2017-12/slick-migration-trick-convert-columns-multi-value-field-subfields which didn't help. It tried to look up the dummy fields and caused it to fail.

I can't be the first person to come across this requirement so I am loathe to write a process plugin for it.

Is there a straightforward solution for this? or is a process plugin the only way?
Turns out the answer on that page is correct, just out of date. Instead of Iterator, it needs sub_process. It also needs a nested array

To create the nested array, I start with a temporary field with the two items it needs

tmp_single_published:
  plugin: get
  source:
    - field_published_by
    - field_published_at


I then plug it into another array and process it.

published:
  plugin: sub_process
  source:
    - '@tmp_single_published'
  process:
    uid: '0'
    at: '1'


This worked for me