I’ve got a D7 to D8 migration where I’m trying to migrate a field with a null value in D7 to a default value in D8. Process pipeline is similar to this:

      plugin: get
      source: field_office_privacy
      plugin: default_value
      default_value: 'open’

It seems if the field value is null, the default_value plugin never runs.

When D7 has a non-null value, then the field migrates perfectly via the get plugin. The D8 API documentation gives this pipeline as an example of exactly what I'm trying to do, yet I cannot get it to work. When I should get a value for all 164 items selected by the migration source, I instead only get 132, which precisely matches the number of fields in D7 that have non-null values.

How can I set a default value when get doesn't find a value?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.