Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Atlassian.Jira Sdk --> can not set Sprint Value in CustomFields

Jens Debernitz January 11, 2019

Hello,

I would like to create a new issue via the Atlassian.Jira SDK and assign it a sprint.

To do this, I add a CustomField to the previously created issue, but when I save the issue I get the following error message:

{"errorMessages":["Number value expected as the Sprint id."],"errors":{}}

 

var story = Global.GlobalSettings.JiraInstance.CreateIssue("CGMDETM");
story.Type = "User Story";
story.Priority = "Major";
story.Summary = "Agile Meetings";
//story.Reporter = Global.GlobalSettings.UserName;
story.FixVersions.Add("19/1");
story.DueDate = DateTime.Now;
story.Assignee = "jens.debernitz@cgm.com";
story.Description = "Hallo das ist eine User Story"; story.CustomFields.Add("Epic Link", TextFieldEpicAgileMeetings.Text);
story.CustomFields.Add("Cost Unit", "Product Investments"); story.CustomFields.Add("CGM Product", "DE65 TURBOMED");
//story.CustomFields.Add("Sprint", @"2/19-1-Turbo.Plopp");
story.CustomFields.Add("Internal Number", "/");
story.CustomFields.Add("DPA relevant", "Irrelevant");
story.CustomFields.Add("Acceptance Criteria", "de.communardo.jira.plugins.acceptance.criteria.beans.AcceptanceCriteria@725d9f55");
story.CustomFields.Add("Business Value", "1");
story.CustomFields.Add("Requirement Type", "Non functional");
story.CustomFields.Add("Sprint", "2/19-2-Turbo.Plopp"); try
{
story.SaveChanges();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}

2 answers

2 accepted

1 vote
Answer accepted
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.
January 11, 2019

The number it wants is the id of the sprint in the database, not the "name" (as those can be non-unique and variable).  You need to either look that up manually, or issue REST calls to find out what it is.  See https://docs.atlassian.com/jira-software/REST/7.3.1/

0 votes
Answer accepted
Jens Debernitz January 11, 2019

Oh Yes I have see it,

 

An another Question:

I will make a Query of my Issus to become all Sprints

What must I do?

var issues = (from i in Global.GlobalSettings.JiraInstance.Issues.Queryable
where i.Project == "CGMDETM" && "Sprint" //&& (from u in i.FixVersions where u.Name == "19/1" select u).ToString() == "19/1"
select i);
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.
January 11, 2019

I do not understand "issues to become all sprints"?  I understand you've got a query to find issues that you want to do something with, but I'm not sure of the rest of the question

Suggest an answer

Log in or Sign up to answer