Feature #11952
openMultiple entries insert in a custom fields list with the REST API
0%
Description
I am working on a conversion from an old system to Redmine and I use the REST API with the .NET client API. I need to set a multiple list custom field with one or more selected values. My conversion is working well for a single value but if there is 2 or more values, the code won't let me insert more than one because the array is converted to an hash in acts_as_customizable
and duplicate values of the key is eliminated by design.
My XML POST
<issue> <subject>AN:1 premier test pour une nouvelle demande</subject> <description>*Problématique* </description> <project_id>2</project_id> <status_id>3</status_id> <category_id>47</category_id> <tracker_id>3</tracker_id> <assigned_to_id>27</assigned_to_id> <fixed_version_id>15</fixed_version_id> <parent_issue_id>0</parent_issue_id> <start_date>2009-08-27</start_date> <custom_fields type=\"array\"> <custom_field id=\"11\"> <value>Guides électroniques</value> </custom_field> <custom_field id=\"11\"> <value>Portails régionaux</value> </custom_field> </custom_fields> </issue>
And the resulting parameter array (partial)
"custom_fields"=>[{"value"=>"Guides électroniques", "id"=>"11"}, {"value"=>"Portails régionaux", "id"=>"11"}],
But if I submit a different key/value it works well by affecting two differents custom fields
"custom_fields"=>[{"value"=>"Guides électroniques", "id"=>"10"}, {"value"=>"Portails régionaux", "id"=>"11"}],
If I manually insert the values in the database, it works also.
The solution would be to convert the parameter array the same way the GUI does for multiple custom fields list.
Bitnami Redmine Stack Environment: Redmine version 2.1.0.stable Ruby version 1.8.7 (i386-mingw32) Rails version 3.2.8 Environment production Database adapter Mysql2