Forums

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

Jira Automation: Getting second-to-last status of an issue

A_ Boehme _Communardo_
Contributor
June 8, 2026

For my current automation I want to make sure that my current issue's second-to-last status was X.

I have found that you can get the last status using the changelog:

{{#changelog.status}}{{fromString}}{{/}}

 If the changelog is a bunch of text, shouldn't it be possible to get the second-to-last status too with the right syntax? Unfortunately I'm not clear on the syntax.

Thanks for any help.

2 answers

0 votes
Sam Okell
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 Champions.
June 8, 2026

Given you are on Enterprise, you could get this from Atlassian Analytics.

 

The jira_issue_history table contains all status changes, and anything with no end date means that this is the current state.

For each state it tracks the previous and current value.

Therefore, you could find the status change with the latest end date, then the previous value field would give you your answer:

Field | Start Date | End Date | Previous Value | New Value

Status | 01/01/2026 | 05/01/2026 | To Do | In Progress

Status | 05/01/2026 |                     | In Progress | Done

 

Something along the lines of:

 

Select jira_issue_history_id

From jira_issue_history

Where 'End Date' Is Not NULL 

And Field = 'Status'

And 'End Date' = (

Select Max ('End Date')

From jira_issue_history

Where 'End Date' Is Not NULL 

And Field = 'Status')

 

Just some more stuff around that to give you details, but should get you there.

 

Outside of this, I can't think of any way to do this through automation. The API may be an option, but not overly convinced it would be any better.

0 votes
Joseph Chung Yin
Community Champion
June 8, 2026

@A_ Boehme _Communardo_ =

The changelog status is always in the format {{changelog.status.fromString}} to {{changelog.status.toString}}..  Maybe if you can provide more information to allow us to assist you further.

What is your current output from your smartvalue?

Best, Joseph

A_ Boehme _Communardo_
Contributor
June 8, 2026

@Joseph Chung Yin Thanks for your reply.

Let's say the issue in question went through the following status: To do > In Progress > Closed. Currently the issue is in status Closed.

This means

{{#changelog.status}}{{fromString}}{{/}}

evaluates to "In Progress".

{{#changelog.status}}{{toString}}{{/}}

evaluates to "Closed".

I am looking for the expression to get the result "To do" (in the scenario described as an example here).

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
TAGS
AUG Leaders

Atlassian Community Events