JQL Last Updated Record based on Custom Field

I have a custom field (Account) and a custom field (Status - Happy, Sad, Indifferent).  We will create a task for each time we reach out to the account to gauge their status.  The status could change each time we reach out to the account, but I want to know the last status for each account.

On Nov 1 we reached out to the account and they were Sad.  On Dec 1 we reached out to the account and they were Happy.  I need to know that they are now Happy.

Any recommendations on the JQL I could use to find the last resolved record for an Account?

3 answers

JQL filters return issues pnly, therefore getting specific issue data like the history of changes of a custom filed along the time is not possible with JQL.

However, there are alternative ways to get such information via the SQL for JIRA:

select c.fromvalue as "Previous State", c.created as "Date"  
from issues i inner join isssuechanges c on c.issueid=i.id 
where c.field='Status' and i.key=? 
order by c.created desc

would provide the history of the Status  custom field along the time given a particular issue key = ?

You might also want to show the results above on a table in the Issue Detail View by creating a custom field for the SQL query above with SQL for JIRA Custom Fields extension.

Or maybe you prefer to create a report for some issues by using the SQL for JIRA Reports and Gadgets.. extension.

Oops, unfortunately, not available for Cloud.

Is your Account field a select list or a text field?  The query will look slightly different depending on the field type.

Your JQL statement will also depend on how you are tracking dates.  Do you have a separate custom field for tracking the date that you reached out to the customer or do you only have JIRA's standard date fields (e.g. Created, Updated, Resolved)?

In this example I'll assume the Account field is a select list and you have a Contact Date custom field.

Project = MYPROJ AND Account = "Customer Co." ORDER BY "Contact Date" DESC

Your most recent contact with that account should then appear as the top issue in the result set.

I would model this like this:

  • Every "reach out" is a sub-task (of a custom type) of the issue which has the custom field "Account".
  • The "reach out" sub-task type also has a custom field "Status".

This every reach out is maintained separately, and can handled in JQL as sub-task.


Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

248 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot