Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get Custom Field last update timestamp

Areg Vrtanesyan _Work_ April 15, 2016

Hi

I am looking to the possibility to get the last update on the Issue custom field if it has modified.

I can get the History Manager but looks like I lost on the further steps ...

 

import com.atlassian.jira.component.ComponentAccessor

def issueManager         = ComponentAccessor.getIssueManager()
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()

def issue = issueManager.getIssueObject("ISSUE-1")
def previousTransitison = changeHistoryManager.getChangeItemsForField(issue, 'CF1')

previousTransitison.each() {
	?????
}

 

I understand that if Issue is just created or only description is updated I will get empty results.

I will handle this by getting back the original Issue Updated timestamp.

 

Thanks,

Areg

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Jamie Echlin _ScriptRunner - The Adaptavist Group_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 28, 2016

It will be something like:

previousTransitison*.created.max()
Areg Vrtanesyan _Work_ April 28, 2016

Worked as a charm !!!!

Thanks a lot.

0 votes
mohit November 7, 2018

Hi @Areg Vrtanesyan _Work_,

I am having same requirement as you described above. did you get any final solution for that? 
would you please help me out for same? 

 

-Mohit

0 votes
Aleks Yenin (Polontech)
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.
April 15, 2016

Hi,

You need to use issue.getUpdated(), that returns timestamp when issue was last updated

 

Areg Vrtanesyan _Work_ April 27, 2016

Hi

I really need to do a bit complicated search.

I need to know when the particular field in the Issue was updated last time and not issue itself.

 

For example I have custom field "CF1" and I have added comment or version or Component to the Issue but did not touched the "CF1".

For my logic as "CF1" is not changed Issue is not updated and it's last update is Issue creation date.

 

If "CF1" is updated I would like to gather the last date when it was updated and use it as Updated in my comparisons.

 

Regards,

Areg

TAGS
AUG Leaders

Atlassian Community Events