Hi there,
I want to know user who updated last fixversion field in a issue and here we are using script runner plugin and my plan is created scripted type custom field called Last updated fixversion user . So need your help how to create script for that field. Please help me how to achieve this.
I had this script it shows the last updated fixversion number
import com.atlassian.jira.component.ComponentAccessor
def changeHistoryManager = com.atlassian.jira.component.ComponentAccessor.getChangeHistoryManager()
def old = changeHistoryManager.getChangeItemsForField(issue, 'Fix Version')
return old?.last().fromString
But i want the who updated fixversion and how to modify the above script to my requirement.
Thanks,
Siva.
You can try this one
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.changehistory.ChangeHistory;
import com.atlassian.jira.issue.changehistory.ChangeHistoryItem;
import com.atlassian.jira.issue.history.ChangeItemBean;
def changeHistoryManager = com.atlassian.jira.component.ComponentAccessor.getChangeHistoryManager()
List<ChangeHistory> changeHistories = changeHistoryManager.getChangeHistories(issue).findAll{ChangeHistory ch ->
ch.getChangeItemBeans().find{it.getField().equals('Fix Version')}
}
if (changeHistories) {
return changeHistories.last().getAuthorObject()
} else {
return null
}
Hi @Tuncay Senturk _Snapbytes_
Thanks for the early reply and your script working perfectly and truely appreciated for your help. Once again thank you very much.
Thanks
Siva.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Pleasure!
I'm glad that it helped.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @siva
I will definitely help if you give me a while.
Meanwhile, have you ever checked Enhancer Plugin? It has First/Last Field Change custom field. You can easily set up and use it for viewing/searching without coding even a single line of code.
For the script, I will try to write it whenever I get free.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please help me how to create script for user who updated last fixversion field.
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.