how to get last issue update for all projects

Yuvi December 18, 2019

Hello Team,

In the projects browser page im able to get "last issue update" time for each project.

our requirement is to get this projects in a single page or can this be done using API?

Thanks.

5 answers

3 votes
Mark Yorgey May 15, 2020

I had a similar need and ended up writing a script that queries the Jira API for every project key. You can use the query below to get the most recent issue update for a project with key "PROJ" for example. It will return 1 result with only the "updated" date field of the most recently touched Jira issue for that project.

<your.jira.site>/rest/api/2/search?jql=project=PROJ+ORDER+BY+updated+DESC&maxResults=1&fields=updated
Nitish Sajwan November 30, 2020

Hi Mark,

Can you please help me with the script. I am also looking for such kind of stuff.

Ben Rivera July 8, 2022

Here is an powershell example:

This just gets the date

$Headers = [Logon info]
$JiraServer = [Jira Server URL]
$ProjectKey =[Project Key]
$HTTPData = Invoke-WebRequest -Uri "$JiraServer/rest/api/2/search?jql=project=$ProjectKey+ORDER+BY+updated+DESC&maxResults=1&fields=updated" -Headers $Headers
$ProjectIssues = $HTTPData.Content | ConvertFrom-Json
$LastIssueUpdate = $ProjectIssues.issues.fields.updated.Split("T")[0]

0 votes
Tom Lister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 17, 2022

Hi 

This is a scriptrunner solution

/*****************************************
Tom Lister 2021

******************************************/

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import org.apache.log4j.Logger

import com.atlassian.jira.user.ApplicationUser
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.Issue

def logit = Logger.getLogger("com.cheil.eu.logging")

ProjectManager pMgr = ComponentAccessor.getProjectManager()
SearchService searchService = ComponentAccessor.getComponent(SearchService.class)
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

String[] categories= [ "Deutsch"]

logit.info("Project Key,Project Name,Category,Lead,Issues,Updated")
categories.each() {String category ->
def p6 = pMgr.getProjectCategoryObjectByName(category)
def proj = pMgr.getProjectObjectsFromProjectCategory(p6.getId())
proj.each() {Project p ->
def cat = p.getProjectCategory()
def lastUpdate
def earliestUpdate
def issueCount = 0

String jqlSearch = 'project=' + p.getKey() + ' ORDER BY updated DESC'
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch)
if (parseResult.isValid()) {
def searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
if (searchResult.getResults().size() > 0) {
issueCount = searchResult.getResults().size()
Issue issue = searchResult.getResults().first()
if (issue) {
lastUpdate = issue.getUpdated()
}
}
}
jqlSearch = 'project=' + p.getKey() + ' ORDER BY updated ASC'
parseResult = searchService.parseQuery(user, jqlSearch)
if (parseResult.isValid()) {
def searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
if (searchResult.getResults().size() > 0) {
Issue issue = searchResult.getResults().first()
if (issue) {
earliestUpdate = issue.getUpdated()
}
}
}


//def category
if (!cat) {category = "none"} else { category = cat.getName()}
logit.info(p.getKey() + "," + p.getName() + "," + category + "," + p.getLead().getDisplayName() + "," + issueCount + "," + lastUpdate + "," + earliestUpdate)

//p.getLead()

}
}
logit.info("Project Key,Project Name,Category,Lead,Issues,Updated")

 
Dan Tombs
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 8, 2022

Hi @Tom Lister

Looking at the script I assume this was for a server instance. Do you know what the cloud equivalent is?

 

Dan

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 11, 2021

I was trying to create an export file of Projects with the same thing @Yuvi was asking for, the Last issue update column that is visible in the UI.

I found my answer with Optimizer for Jira. It allows you to add the "Last issue update" column to its listing of Projects, and then export that list as CSV.

Marc Porto (US - ADVS) March 11, 2021

@Darryl Lee 

I have DC and was wondering, when you say it allowed you to add the column to its listing of projects and then export that list as CSV, does it add an export feature in the System --> Projects section or does it open up the option to add the column in Issue Navigator to somehow pull projects by last issue update? 

Right now, I have the column when I go to see all my projects in my instance but have no way to export the list so am curious. I don't have a solid way via Issue Navigator to narrow down by project versus issues so trying to get a better understanding whether this may meet our needs. 

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2021

Optimizer has its own separate UI and section in Jira to display Projects and other various Jira objects that it can help you optimize.

As pictured below, their UI has the additional "Last Updated" column along with an export to CSV option.

3b432e49-1be3-4da5-ad8a-7edd3d294fbc

A heads-up though: The trial license limits you to viewing/exporting only 25 projects. (I assume the vendor got tired of people "trying their app for free" and then after gathering the necessary info, not purchasing.)

It is indeed disappointing that that column is visible on the standard Jira manage projects screen, but not exportable. Perhaps I could script something to scrape those pages...

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 11, 2021

BAH, so much for my scraping idea. I went and did an acli renderRequest for 7 pages of Projects and it was all for naught.

Friggafragging dynamically loading Javascript grrrrr....

(Oh how I long for the olden days of simple server-side apps that are easily scrapeable as HTML.)

Like # people like this
0 votes
Damian Wodzinski
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.
December 18, 2019

It will be hard. You can write a script that is running trough all projects and is comparing the data of the last updated ones. Or if you can somehow order Issues in project by Updated Time and grab the newest one, this would be easier. 

But I do not have a ready script for that.

0 votes
Damian Wodzinski
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.
December 18, 2019

I don't understand what are you trying to get. List of projects that were updated? Every one of them was updated at the certain period of time.

Yuvi December 18, 2019

Hello @Damian Wodzinski ,

Sorry for the confusion.

We want to get the last issue updated date of each project.Capture.PNG

Like Marie NB likes this

Suggest an answer

Log in or Sign up to answer