I have a very simply console app which I'm using to wrap my head around the JIRA .Net SDK. Most of it is quite straight forward to use but my main thing is being able to change the status and priority of issues programmatically.
I have the following code inside my main method:
var issues = from i in jira.Issues.Queryable
where i.Summary == "Issue 2" && i.Assignee == "admin"
orderby i.Created
select i;
foreach (var issue in issues)
{
Console.WriteLine(issue.Summary);
Console.WriteLine(issue.Resolution);
Console.WriteLine(issue.Status);
issue.Priority = IssuePriority.lowest.ToString();
//issue.Resolution = "10000";
//issue.Resolution = "10003";// ResolutionStatus.done.ToString();
issue.SaveChanges();
}
This code happily brings back my issue and I can change the summary, priority and all the other bits via code just fine. However, when I try and use the Resolution and Status options, I get errors.
I created 2 enums that hold the expect values inside them:
public enum IssuePriority
{
highest = 1,
high = 2,
medium = 3,
low = 4,
lowest = 5
}
public enum ResolutionStatus
{
done = 10000,
wontDo = 10001,
duplicate = 10002,
cannotReproduce = 1003
}
But when I try and change the resolution, I get the following error:
"Response Content: {\"errorMessages\":[],\"errors\":{\"resolution\":\"Field 'resolution' cannot be set.
It is not on the appropriate screen, or unknown.\
Looking at the description of resolution is has a getter and setter, but still the issue persists. Have anyone combatted this error before?
Hi Sean
Using the code I suggested in your earlier question, I transition an issue to the Resolved status with
RunQuery(
null,
"{\"update\":{},\"transition\":{\"id\":\"241\"},\"fields\":{\"resolution\":{\"name\":\"Done\"}}}",
"POST")
The first parameter passes the issue id in as {JiraKey}
The third parameter is a Json packet, where transition specifies what status to change to (depending on your workflow) and resolution is the resolutionstatus that you were trying to set
The fourth parameter is now not GET but POST
Then I close it with
RunQuery(
null,
"{\"update\":{},\"transition\":{\"id\":\"141\"}}",
"POST")
Let me know if you have any further questions about this
There's a couple of underlying principles in this that Warren handles perfectly and automatically but doesn't explicitly mention
1. REST respects your setup. You need the Resolution to be on the screen so you can set it. An additional wrinkle to that is that any competent JIRA admin will *never* put the Resolution on anything other than a "transtion" or "view" screen.
2. You cannot "set" status (it only works when importing issues, not "edit" or "update"). You must transition from one status to another.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.