I have been trying to create contacts data using Drush and the CiviAPI. I get an error when I try to add data to a multi-select field despite using exactly the same syntax that the API explorer gives me.
I have a custom field (machine name: custom_10) that takes up to 5 options. As an example, If I use the API explorer to create the following output, I get this:
drush cvapi Contact.create contact_type="Individual" contact_sub_type="MySubType" custom_10=[1,2,3] first_name="John" last_name="Doe"
Executing this though the API explore works fine, but if I copy the drush line and execute it, the array data for custom_10 causes an error:
Array
(
[error_field] => custom_10
[error_code] => 2001
[entity] => Contact
[action] => create
[is_error] => 1
[error_message] => '1,2,3' is not a valid option for field custom_10
)
executing a single option with custom_10=1 will work fine. I have tried various different syntax but cannot get it to take. Has anyone else had this issue with the Drush approach for arrays in Custom fields?
I have no issues adding anything else Contact wise including chaining for additional emails. It is just fields that have arrays of data.