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.
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
Hi Mark,
Can you please help me with the script. I am also looking for such kind of stuff.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tom Lister
Looking at the script I assume this was for a server instance. Do you know what the cloud equivalent is?
Dan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Damian Wodzinski ,
Sorry for the confusion.
We want to get the last issue updated date of each project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.