Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

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);

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
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,873 views 11 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you