1

I'm having problems importing memberships with a custom field. I'm able to import a alphanumeric text field without an error, but a second custom field, set up as a checkbox, keeps being rejected.

The import CSV file originally had the option label in that field, but after changing this to the option value, the import is still rejected as invalid. What might I be missing here?

The original import error reads 'Invalid value for field(s) : Income; Income'

When I change the relevant fields to the correct value 'LowIncome' (having double checked that it's the value stored in the database), the import error reads:

'1' is not a valid option for field custom_33

Which is technically correct, but none of the fields in the imported file contain '1', so I don't know where it's getting this from!

Because there's only the one option, I'm pretty sure I can swap this out for a Yes/No field and try it again, but I'd rather pin down why this is happening - I also have some activities to import with multi-option checkboxes, and I'd rather know they'll work...

ETA: I've tried adding in another field, where the option label, value and name are all the same ('Test'), and importing it - It gets flagged in the same way - '1' is not a valid option for field custom_34

I also tried adding a yes/no field, and that imports okay, so I'm probably going to switch this particular field to a yes/no, but as I say, I'm concerned that it's going to reject other multichoice fields, and I'd still like to pin down the problem. I will try importing some of the activities, and update this when I know how it's behaving.

ETA2: This seems to be happening for any checkbox field, regardless of what the custom data set is used for, and isn't limited to fields with single checkboxes. I'm able to reproduce the problem in the master demo site, and importing from my new installation to the older version of CiviCRM also comes up with this error.

I've found a issue on the old bug tracker site that seems very similar in 4.7/4.7 - https://issues.civicrm.org/jira/browse/CRM-17493 - and although it's marked as fixed, it looks a little as though the fix was never implemented in 4.7 - the last git pull request is marked as closed with the note 'Unclear if a fix is required or not': https://issues.civicrm.org/jira/browse/CRM-17493 (but it's also not entirely equivalent to the problem I've been having)

Failing any further ideas as to what I might be doing wrong, I'll raise it as a bug.

  • can you run an sql statement to update a checkbox to 'LowIncome'? if yes it's probably a formatting problem with your csv file? If no then you need to figure out what value you are able to set the field to. – dgk112 Aug 28 '18 at 15:46
  • I'm honestly not sure how to update a field via sql - I'm happy to try it but literally don't know how :( – liblogger Aug 29 '18 at 14:31
  • The csv file has been exported from another (older) installation of CiviCRM, and I've been editing it both as a text file and in Excel - they all fail, but I wouldn't have thought it's a formatting issue when the other fields are okay. What might I be missing? – liblogger Aug 29 '18 at 14:33
  • tutorialspoint.com/sql/sql-update-query.htm syntax for SQL update statement here so (assuming you have phpmyadmin access to your database) update [Table] set field = 'Lowincome' where [id] = – dgk112 Aug 29 '18 at 20:26
  • does that help at all? have you managed to get the data imported now? – dgk112 Sep 7 '18 at 18:41
1

Try using the machine name instead of Label or Value. I believe for some cases it uses machine names rather value or label. You can find the machine name either using sql stmt or through api explorer.

Here is an example of some cases where value or label didn't work during import.

  • I'm assuming the machine name is the 'name' in the civicrm_option_values table? This didn't work either, I'm afraid. (I'd thought 'Value' was the machine name, so thanks for the clarifcation!) – liblogger Aug 29 '18 at 14:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.