@payloadcms/plugin-import-export: Issue with exporting relationship and array fields #11979
Answered
by
DanRibbens
Phyo-Alpha
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
DanRibbens
Jun 10, 2025
Replies: 1 comment 1 reply
-
Hello @Phyo-Alpha We added a new feature that was released yesterday in v3.42.0. The plugin now allows you to add a new toCSV function that you can write to modify the data or return a different value. Here is an example of a relationship field that adds the {
name: 'customRelationship',
type: 'relationship',
relationTo: 'users',
custom: {
'plugin-import-export': {
toCSV: ({ value, columnName, row, siblingDoc, doc }) => {
row[`${columnName}_id`] = value.id
row[`${columnName}_email`] = value.email
},
},
},
}, If you wanted to just change the value from We're working on the import half of the plugin and then docs will be added to the site. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Phyo-Alpha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @Phyo-Alpha
We added a new feature that was released yesterday in v3.42.0. The plugin now allows you to add a new toCSV function that you can write to modify the data or return a different value.
Here is an example of a relationship field that adds the
customRelationship_id
andcustomRelationship_email
to the csv:If you wanted to just change the value from
id
toemail
you would justret…