Groovy script: pull the issue history for only certain fields going back a certain time frame?

Marleah Perry
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 2, 2024

I am trying to use groovy script to pull issues and their change history for only certain fields (label, summary, status and a custom field) going back only a certain time frame (most likely using 3 months). I found this (https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/issue/changehistory/ChangeHistoryManager.html) which shows how to pull issue history from a certain date and also for certain fields, but I can't use a specific date. I can't upload a new template to Jira each time with an updated date. Instead, I want to just pull the history going 3 months back from the current date at the time of export. And I want to only pull specific fields changed. I am using excel for this, so I want one column with the label, another with issue name (summary), another column with the field changed, and then a final column with the new value the field was changed to. I am looking for this (including the repeating but I can do that with macros as well) but narrowed down fields to avoid such a large export (https://www.midori-global.com/products/better-excel-exporter-for-jira/server/export-samples/jira-issues-excel-reports-with-comments-worklogs-history). Looking for groovy script for each column. Thank you!!

 

jira-issues-selected-fields-with-repeating-worklogs.png

1 answer

1 accepted

3 votes
Answer accepted
Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 2, 2024

Hi, @Marleah Perry 

Welcome to Atlassian Community.

You can try this code, that I made for similar tasks:
https://github.com/Udjin79/SRUtils/blob/master/org/evisaenkov/atlassian/library/HistoryOperations.groovy

You can pull history entries by custom field. Also you can write additional code to look at change date and filter only required changes.

Marleah Perry
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 2, 2024

Thank you!!

Suggest an answer

Log in or Sign up to answer