issue.Savechange() throw unknown exception after setting issue priority value.

Ming Liang April 21, 2021

Hi, guys

The .NET program I used to create Jira issues automatically fails to save the new created issue. But I can create and save a issue manually when I log in Jira in browser. See the attached pics for exception details. What causes this exception? thanks.

JiraException.jpgJira.JPGJira2.JPGJira3.JPG

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 22, 2021

This is something broken in whatever library or application you are using to talk to Jira with.  You'll need to fix your code such that it makes a valid call.  You've not told us what you're using, so we can't tell you much more than that.

Ming Liang April 22, 2021

The code was working perfectly until April 20, so I guess there was something changed on Jira server side that causes this issue. 

 

 

Atlassian.NET SDK 12.4.0

Jira.JPG

 

Ming Liang April 27, 2021

Hi

 

The problem is resolved after removing following code, weird.

new_issue.Priority = "None";

 

Should I use priority id instead?

 

How should I know which id to represent the values in the drop list:

None, Highest, High, Medium, Low, Lowest.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 27, 2021

It's usually the id you need.  I think you should have a look at the project though, the "change" might be that someone removed priority or changed the priority scheme.

No priority usually means "nothing selected, field is empty" though, which is usually a null, or not sending anything at all.

Ming Liang April 27, 2021

I tried following two ways to set priority, but they all triggers that exception.

So, what is the correct way to do it in .net code? Thanks.

 

// set priority based on CVSS score
//1 = Highest 2 = High 3 = Medium 4 = Low 5 = Lowest 6 = (not used) 7 = None
if (score <= 0.0)
new_issue.Priority = "7";
else if (score >= 7.0)
new_issue.Priority = "2" ;
else if (score <= 4.0)
new_issue.Priority = "4";
else
new_issue.Priority = "3";

new_issue.SaveChanges();

 

// set priority based on CVSS score
if (score <= 0.0)
new_issue.Priority = "None";
else if (score >= 7.0)
new_issue.Priority = "High";
else if (score <= 4.0)
new_issue.Priority = "Low";
else
new_issue.Priority = "Medium";
new_issue.SaveChanges();

Suggest an answer

Log in or Sign up to answer