Forums

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

Is there a way to get issue history/changelog using jira server sdk?

KL Kumar
Contributor
August 9, 2018

Hello,

I am using Jira Server version and I have a requirement of getting all the changes done for some fields since the issue created. I have implemented this using rest api (changelog), but the response from the rest api is taking too much time (almost 15 seconds) and this is a performance issue in my application. So thinking that, is there any alternative for rest api to get the issue history. For example, is there a way to get the issue history using Jira server SDK?

 

Thanks in advance!

Kumar

1 answer

1 accepted

2 votes
Answer accepted
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 Leaders.
August 9, 2018
KL Kumar
Contributor
August 9, 2018

Hi Alexey!

Thanks for your prompt reply. This is what exactly I am looking for. Now I can get the change history for the fields.

Along with the change log of the field, is it possible to get the name of the person who changed its value ?

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 Leaders.
August 10, 2018

Yes, it is possible:

You need to use  getChangeHistories(Issue issue) method of the ChangeHistoryManager class.

https://docs.atlassian.com/software/jira/docs/api/7.0.9/com/atlassian/jira/issue/changehistory/ChangeHistoryManager.html

def changes = ComponentAccessor.getChangeHistoryManager().getChangeHistories(issue);
changes.each {change ->
log.error(change.getAuthorObject())
change.getChangeItemsBeans().each {item ->
your logic here.
}
}
Like Azfar Masut likes this
KL Kumar
Contributor
August 10, 2018

Great! This completes my requirement.

Thanks Alexey!

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 Leaders.
August 10, 2018

You are welcome!

Suggest an answer

Log in or Sign up to answer