Forums

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

Query the changelog

Alexander B.
Contributor
January 17, 2023

Hi all,

I experimented a little. I want to have the this information in a custom field:

FromToBy Retaining time
(status)(status)(displayName)...0 days 0 hours 1.0 minutes in (status)

I did the following:
- Access the REST api
- Get the changelog with the EXPAND parameter
- put the results in a map
- iterate through the history segment of the map for status changes
- extract author, created and status change
- calculate the retaining time
- display the result via velocity template

This works fine in the preview but kills Jira when put into production ;-)

Is there a better alternative to get the same results?

Thanks!

1 answer

1 accepted

0 votes
Answer accepted
Alexander B.
Contributor
January 18, 2023

Ok I've found an alternative using ChangeHistory and ChangeHistoryManager:

  • Retrieve all change history items for the issue
  • Create a list to store status changes
  • Iterate through the change history items and add status changes to the list
  • Check if any status changes were found for the issue
  • Get the creation date of the issue
  • Add a new variable to each status change
  • Convert the duration for the retaining time
  • Display the result via velocity template

Have a nice time!

Suggest an answer

Log in or Sign up to answer