Reputation: 1
I try to create an issue with redmine-net-api that uses CustomFields (mainly text boxes) that are marked as required.
I could get a list of CustomFields by using RedmineManager.GetObjects<CustomField>(new string[] { })) and I use them to create my list of IssueCustomFields, but I'm not allowed to change the ID due to the fact that the set accessor is protected.
I set name and value but when I call RedmineManager.CreateObject<Redmine.Net.Api.Types.Issue>(...) the name of a custom field will be ignored and the transmitted Xml block contains the IDs that I can't set (id="0"). Taking a look with wireshark give me the following xml that is transmitted to Redmine:
<issue>
<subject>Test 16.08.2024 18:35:19</subject>
<notes />
<description />
<is_private>false</is_private>
<project_id>1</project_id>
<priority_id>2</priority_id>
<status_id>1</status_id>
<tracker_id>4</tracker_id>
<estimated_hours />
<start_date />
<due_date>2025-08-16</due_date>
<updated_on />
<custom_fields type="array">
<custom_field id="0">
<value>E12993</value>
</custom_field>
<custom_field id="0">
<value>System</value>
</custom_field>
<custom_field id="0">
<value>C:\\x0d\x0ad:\\x0d\x0a</value>
</custom_field>
<custom_field id="0">
<value>Ich\x0d\x0aDu\x0d\x0aWir\x0d\x0a</value>
</custom_field>
<custom_field id="0">
<value>Weiterer Text</value>
</custom_field>
</custom_fields>
</issue>"
How can I either set the correct ID for the custom fields or get the Redmine Manager to use the name of the field instead of the ID?
I tried to set the IDs by using JSONWriter and JSONReader but this didn't work, Changing source code didn't work and I'm not very much skilled in these techniques where JSON and objects are combined.
I tried quiet some tutorials but these didn't work either even those from the creator of this library (zapadi).
So the IssueCustomField is a sealed class and I didn't work with that either. I had the feeling that I miss some common understanding of this way of programming/using this type of technique because blocking an ID otherwise makes no sense if it's neccessary for communication?
Upvotes: 0
Views: 36