Forums

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

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 Champion
October 2, 2024 edited

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
TAGS
atlassian, atlassian community, loom ai, atlassian loom ai, loom, atlassian ai, record recaps of meetings, meeting recaps, loom recaps, share meeting recaps,

Loom’s guide to great meetings 📹

Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.

Register today!
AUG Leaders

Atlassian Community Events