JetBrains / YouTrackSharp

.NET Standard 2.0 Library to access YouTrack API.
https://www.jetbrains.com/youtrack
Apache License 2.0
135 stars 105 forks source link

issue in custom fields when creating new issue. #11

Closed kbagher closed 12 years ago

kbagher commented 12 years ago

hi, i'v tried several times to create a new issue that contains custom fields but it just won't work. i even tried to get an issue from the YouTrack and use it's object to create a similar one:

var issueManagement = new IssueManagement(connectionObject);
dynamic issueObject = issueManagement.GetIssue("SPM-191");
issueManagement.CreateIssue(issueObject);

but it also won't add any data to the the custom fields.

hhariri commented 12 years ago

I'll take a look at this.

wallaceturner commented 12 years ago

I've run into this too.Assume you have a field called OldPriority that you are assigning into your dynamic Issue:

issue.OldPriority = "0.99";

and over the wire: (fiddler)

project=MERC&summary=summary&description=description&assignee=fooPerson&type=Bug&state=New&subsystem=Bunker+-+Screen&oldpriority=0.99

When you fetch the issue back it looks like this:

 "field":[{"value":[],"name":"OldPriority"}]

but should look like:

[{"value":["0.99"],"name":"OldPriority"}]

It doesnt seem to matter how you assign OldPriority. this also fails:

issue.OldPriority = new[] { "0.99"};
hhariri commented 12 years ago

I'm looking at this.

hhariri commented 12 years ago

This is related to this:

http://youtrack.jetbrains.com/issue/JT-10043

Which means, that unfortunately, until that is fixed, we can't set any custom fields without explicit command. Which sucks. :(.

The reason all the other fields work, even though they are custom is because they "shipped" out of the box. So I'm open to suggestions....

hhariri commented 12 years ago

One thing might work. Go thru the list of fields and see if they were predefined fields. If so, ignore, if not add to list of fields to set AFTER the issue has been created successfully. Still involves several requests but at least it will be transparent to the user.

hhariri commented 12 years ago

OK i've implemented the above and tests seem to work. Please test and if you run into issues reopen. But right now you should be able to add any custom field.

wallaceturner commented 12 years ago

Thanks Hadi