Closed adrianjean closed 1 year ago
Related element field values are posted as an array of element IDs, which is the format that the import expects as well. So [1]
for one element and [1, 2, 3]
for multiple elements. Does that work?
I’ve added info modals with instructions for fields that expect specific formats in https://github.com/putyourlightson/craft-campaign/commit/25dcb8a5ad6e4c48b160066979055a71e60a13c3, for the next release.
Ok, using brackets around the values works but only for single values. Multiple values fails.
What's funny is the logs error out as if it doesn't understand the next value as the problem, but it's the array that only changed.
Can you show me what the logs say?
Here's the CSV
email,contactFirstName,contactLastName,contactPhone,contactAddressStreet,contactAddressPostalCode,contactGender,contactGroup,contactSupport,contactVolunteer,contactWard,contactDonationAmount
test2@email.com,Sarah,Smith,555-445-2354,"47 Main St.","Z1Z1Z1",female,[25738],no,volunteer,[25772,25771],800
When imported here is the log report:
[2023-05-27 08:26:33] Line 1: Donation Amount must be a number.. Donation Amount must be a number.
Some notes:
Could you test using this format? Assuming it works, I can add a fix for the next release.
"[""1"",""2""]"
Oh I think I see the issue, it's the comma separating the IDs, so this will likely work.
"[1,2]"
That works "[1,2]"
for Category fields — however for "Multi Select" fields, the same technique doest work.
Right, that will only work for integers, strings must still be surrounded by double double quotes.
Yes!
It works for Multi Select using format "[""donor"",""adamList""]"
and the "values" or slugs.
Seems all sorted now. Thank you so much for being so responsive!!
So:
"[""varOne"",""varTwo""]"
"[25772,25771]"
In both cases, the variables/categories already need to exist in CraftCMS
Yup, that’s correct and added to the import field info modals for the next release.
Following up on: https://github.com/putyourlightson/craft-campaign/issues/390
Seems I was wrong, Category fields don't import from CSV either. Imports complete without error, but it appears the data for the category is ignored by the import and no category is set on the contact's profile field.
I tried importing by:
None of them work.