Forums

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

Programmatically change Due Date

Michael Wagner
May 2, 2018

Hi,

We are using Jira in our company and we do really have customized a lot of it.

 

I have created a C# application in which I can do some controlling for my team and their tickets. Now I want to extend this to be able to resort tickets based on their due date.

Last step of this process is to write the due date back into the database. This is done by writing a new date in dbo.jiraissue.DUEDATE (and of course the change log).

So far, I do see my updated date when I look in the ticket but unfortunately I still see the old date in every filter.

I had a look in the database scheme and I couldn't find related places.

How can I make this work? Where do I need to write to as well to make filters work correctly?

Or do you have an easy to use API which I can use from a client application to update the due date?

 

Thx

Michael

1 answer

0 votes
Alexey Matveev
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 Champions.
May 2, 2018

The problem is that Jira does not take data from the database. It takes data from indexes and indexes are built on the database data. The process of putting data into indexes from the database is called Reindexing.

To update data in the database is an akward way. Better user Jira REST API to update issue fields:

https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/?_ga=2.263327749.827101953.1525326998-1659643416.1506407535

Michael Wagner
May 3, 2018

Thx for the answer. Do you have a quick example how to access the due date?

I found https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/?_ga=2.167621816.767163120.1525327900-1751293415.1511335262#api/2/issue/{issueIdOrKey}/properties but is this the correct way?

 

I could also use curl if you have examples there :)

Alexey Matveev
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 Champions.
May 3, 2018

That would be

PUT rest/api/2/issue/{issueIdOrKey}

with JSON

{
"fields": {
"duedate": "2011-03-11",
}
}

Or you can install the REST API Browser plugin. There will examples of the correct jsons

Michael Wagner
May 3, 2018

I have a strange behavior: The response returns ok, but the data is not overwritten.

I am sending a PUT to url {ourjira}/issue/{ticketId}/properties/duedate with json "{\"fields\": {\"duedate\": \"" + dueDate.ToString("yyyy-MM-dd") + "\",}}

 

Response status is OK. What am I doing wrong?

Alexey Matveev
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 Champions.
May 3, 2018

Kindly check the json, which is returned by the REST call. Did you try it in the REST API Browser?

Michael Wagner
May 3, 2018

I found the issue - my JSON had a small issue.

Thx, it is working now

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events