Skip to content
Discussion options

You must be logged in to vote

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 and customRelationship_email to the csv:

{
  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 id to email you would just ret…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DanRibbens
Comment options

Answer selected by Phyo-Alpha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants