For security purposes I am looking for a way to show all the tickets for a particular project between time x and y.
If I change the url a bit I can get to something like this:
https://contexta.atlassian.net/browse/ISO-77?jql=created%20%3E%3D%20-4w%20ORDER%20BY%20created%20ASC
Which gives me the last 4 weeks of all project but I have a hard time finding out how the syntax should be exactly. Anybody who can show me an example?
Use jql which is better but you may add this.
?jql=project%20%3D%20<project code>%20AND%20createdDate%20<%3D%202019-07-01%20AND%20createdDate%20<%202019-07-31
JQL is
project = <project code> AND createdDate <= 2019-07-01 AND createdDate < 2019-07-31 ORDER BY updated DESC
I would like to get the worklogs list from my Jira without specifing an issue.
Yet I have:
jira = JIRA(basic_auth = ('username', 'password'), server='server_name')
issue = jira.search_issues('key=ISSUE-XXX')[0]
wklog = jira.worklogs(issue)
and I would like to have all the worklogs, i.e. something like:
jira = JIRA(basic_auth = ('username', 'password'), server='server_name')
wklog = jira.worklogs('')
Is it possible? Any suggestions? thanks in advance !
In order to get all the issues' worklogs without specifying one particular issue or project, you have to loop through all the issues.
To do this, you have to execute a search on the system with this query:
all_project_key = jira.search_issues('project is not empty&fields=key')
This will return the first 50 issues key of the system and a number, in the field maxResults, of the total number of issues present.
Taken than number, you can perform others searches adding the to the previous query:
&startAt=50
With this new parameter you will be able to fetch the issues from 51 to 100 (or 50 to 99 if you consider the first issue 0).
The next query will be &startAt=100 and so on until you fetch all the issues in the system.
If you wish to fetch more than 50 issues, add to the query:
&maxResults=200
Once you have finished looping through the system, you will have the list of all the issues where you can loop to retrieve the worklog of that issue.
Unfortunately I don't think you can fetch all the worklogs of all the issues at once.
EDIT:
Added query in JIRA python.
In my application a User has Highlights.
Each Highlight has a HighlightType. So if I run user.highlights I might see an output like this:
Notice that there are many highlights of type_id 47. This marks milestones of the number of times the user has gone running.
What I would like to do is return this full list of records, but only include one highlight for each highlight_type, and I want that one record to be the most recent record (in this case the "50th run" highlight). So in the example above I would get the same results but with IDs 195-199 removed.
Is there an efficient way to accomplish this?
I don't think there is an easy or clean way to achieve that, nor a "Rails way". Look at e.g. this link
According to one suggestion in that link you would do this SQL request:
SELECT h1.*
FROM highlights h1
LEFT JOIN highlights h2
ON (h1.user_id = h2.user_id
AND h1.highlight_type_id = h2.highlight_type_id
AND h1.created_at < h2.created_at)
WHERE h2.id IS NULL AND h1.user_id = <the user id you are interested in>
group by h1.highlight_type_id
I think it will be some performance problem if you have big tables maybe, an it not so very clean I think.
Otherwise, if there isn't so much highlights for a user I would have done something like this:
rows = {}
user.highlights.order('highlight_type_id, created_at DESC').each do |hi|
rows[hi.highlight_type_id] ||= hi
end
# then use rows which will have one object for each highlight_type_id
The DESC on created_at is important
EDIT:
I also saw some suggestions based on this
user.highlights.group('highlight_type_id').order('created_at DESC')
And that was also how I first thought it should be solved, but I tested it and it doesn't seems to get a correct result - at least on my test data.
How do I write a query in TFS to show me users that have added comments in the history section of a work item in the past 2 days?
Team Project = # Project
And Work Item Type = [Any]
And History Contains MY_KEY_PHRASE
And Changed Date >= #Today - 2
Since Contains cannot be null we have to add a value to the History search.
MY_KEY_PHRASE = Whatever you want to put in your comments field, as a standard, to identify changes (such as "comments" or "cc" or "." etcetera).
The easiest solution is to use prefix before any comments, so any one need to write comments just write "Comments:" keyword followed by carriage return before his comments and then
Edit the query
Add new criteria as the following:
(And/Or)--> And
(Field)---> History
(Operator)--> Contains
(Value)--> Comments
Thanks
M.Radwan
We use Jira extensively in our project, but I often have a hard time finding issues, that I know, I have been working on earlier. Usually, if some case is reported, that seems familiar to something I have been working on in the past, but I don't remember exactly what and when.
Usually, an issue is reported, then our scrum master assigns it to the developer, the developer fixes it (hopefully) and then passes it to the tester (yay, it works!). But then it is no longer assigned to me, and I have a hard finding old issues, that I remember vaguely.
I thought, perhaps it is possible to see the assigned history of an issue, there might be a way to form an advanced search/filter, that finds all issues, that at some time has been assigned to me.
Has anyone done this?
This is meanwhile possible by means of the JIRA Query Language (JQL) operator 'WAS', which has been introduced in JIRA 4.3 and extended in JIRA 4.4 to cover assignees and reporters as well, for example:
project = "Angry Nerds" and (assignee was 'johnsmith' or reporter was 'johnsmith')
General-purpose query for whichever 'current user':
assignee was currentUser()
This filter can be conveniently shared & anybody can put it on their dashboard, etc and it will return results specific to them.. Not supported on all old JIRA versions though.
This was my most-requested JIRA feature ever.
Check out JIRA Toolkit plugin - Participants custom field
https://studio.plugins.atlassian.com/wiki/display/JTOOL/JIRA+Toolkit+Plugin
This field allows you to easily track issues that you've "participated in". These are defined to be any issues you've commented on, raised or are the current assignee. See also the [JIRA Extended Participants] plugin.
Update
This works without plugins:
assignee was currentUser() OR reporter was currentUser() ORDER BY updated DESC
The original answer
This query worked for me:
Participants = currentUser()
try "assignee was username". it would get all tickets been assigned to the user before.
You can find issues by worklog entries directly in the database:
select distinct ji.pkey from jiraissue ji inner join worklog wl on ji.id=wl.issueid where wl.author='some_username';
I agree this should be implemented in the UI though.
For those that will be using JIRA 5+, there is also CHANGED operator that looks at the field changing to specific value within specific time range.
assignee CHANGED TO currentUser() AFTER startOfYear() BEFORE now()
More here: https://confluence.atlassian.com/display/JIRA052/Advanced+Searching#AdvancedSearching-CHANGED
Just another way how to achieve the same result, but might be useful for other cases.
was is not supported to assignee field when I tried recently. You must use CHANGED, FROM, TO keywords to filter.
I'm using something like this:
project = MindBlowingProject AND (assignee in (currentUser()) OR assignee CHANGED from (currentUser()) OR reporter in (currentUser())) ORDER BY updated DESC
So there are 3 scenarios:
1 - I changed it in some way - assignee changed by [UserName],
2 - I changed the status ( closed it, whatever) - OR status changed by [UserName],
3 - I still have it - OR assignee = [UserName]
So the whole query (assuming that the changed statement is allowed is:
assignee changed by [UserName] OR status changed by [UserName] OR assignee = [UserName]
I think the most sensible approach is to search the issue-history. The only thing, that is not logged there, is who accessed the issue (just watching, without changing anything).
But you can't search the ticket-history without database access (as far as I know, please correct me if I'm wrong)
So, to search all issues with "someUserName" in the issuehistory, you have to inner join the table changegroup (and maybe the table changeitem from there).
Example:
select ji.id,issuenum,summary,creator,assignee,ji.created,updated,c.id as histid,c.author from jiraissue ji inner join changegroup c on ji.id=c.issueid where c.author like 'someUserName';
c.id as histid ==> this is the number/id of the entry in the (issue-)"History" tab
Meaning: if there ever was a change by the user "someUserName" it is logged in the History and it will be listet with this query
The following example will just list every disting issue, where the "myusername" was found in the History after the date 20180501:
select distinct ji.id,issuenum,summary,creator,assignee,ji.created,updated,c.author from jiraissue ji inner join changegroup c on ji.id=c.issueid where c.author like 'myusername' and ji.created > '2018-05-01T00:00:00.000';
I annotated the necessary relation here:
From menu select Tempo->Reports
Select date-range
and you should see report.
I tried the below SQL query and it gives data of all the issues and all the assignees that were ever assigned to an issue. Any change in the assignee for any issue is captured by below query:
select distinct
p.pkey +'-'+cast(ji.issuenum as varchar(max)),
ji.SUMMARY,
cast(ci.OLDSTRING as nvarchar(max)) as 'Old value',
cast(ci.NEWSTRING as nvarchar(max)) as 'New value'
from
jiraissue ji
join project p on p.id = ji.PROJECT
join changegroup cg on cg.issueid = ji.id
join changeitem ci on ci.groupid = cg.id and FIELD = 'assignee'
Anyone looking for the query would find this useful : )
-Neha 'D' Pal