error in jira not able to update status

Tuhiram singh October 1, 2021

Hi team i am not able to update status of the issue please help asap.

 

var data = new Issue();
data.fields.project.key = "VRM";
data.fields.summary = obj.summary;
data.fields.description = obj.description;
data.fields.issuetype.name = obj.issuetype;
data.fields.status.name = obj.status;
data.fields.priority.name = obj.priority;

string postUrl = String.Format("{0}rest/api/2/issue/{1}", Url, obj.issueid);
System.Net.Http.HttpClient client = new System.Net.Http.HttpClient();
client.BaseAddress = new System.Uri(postUrl);

byte[] cred = UTF8Encoding.UTF8.GetBytes("XXXXXX:XXXXXX");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(cred));
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
System.Net.Http.Formatting.MediaTypeFormatter jsonFormatter = new System.Net.Http.Formatting.JsonMediaTypeFormatter();
System.Net.Http.HttpContent content = new System.Net.Http.ObjectContent<Issue>(data, jsonFormatter);
System.Net.Http.HttpResponseMessage response = client.PutAsync(postUrl, content).Result;
if (response.IsSuccessStatusCode)
{
result = true;
// result = response.Content.ReadAsStringAsync().Result;

}

6 answers

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 5, 2021
0 votes
Tuhiram singh October 5, 2021

how i can use transition  please give example.

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2021

To change the status of an issue, you use the transition that takes it to the new desired status.

0 votes
Tuhiram singh October 4, 2021

image.png

please look my work flow . how i can update status if particular issue

0 votes
Tuhiram singh October 4, 2021

hi @Nic Brough -Adaptavist-  I am using default workflow right now . so what the transtition please help me

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 1, 2021

Status is not a field, you can't just throw a value at it.  It is a display of where an issue is in its wrokflow.

You'll need to look at the workflow for the issue and work out which transtition(s) you need to push the issue through to get to the status you want.  Your code will then need to command those transitions to happen.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events