Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Custom Field showing Last Modified User of an issue

I found some of code in the forum for a scripted field but can not get it to work with the latest software. 

Any help appreciated 

import com.atlassian.jira.component.ComponentAccessor

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def changeItems = changeHistoryManager.getAllChangeItems(issue)

if (changeItems?.size() > 0) {
    def userUtil = ComponentAccessor.getUserUtil()
    def userkey = changeItems.sort(false).last().getUserKey()
    userUtil.getUserByKey(userkey)
} else {
    null
}

1 answer

scripted fields only fire on transitions.  and if you are okay with it being updated on transition then you dont even need SR to track.

 

Just add a custom field and add a "Update Issue Custom FIeld" post function with the field selected and this for the value: '%%CURRENT_USER%%'

Thanks for the feedback the best option would be a listener which I have not found any good examples as of yet 

No, scripted fields are updated at a lot of other times.   It's an oversimplification, but you can almost always assume a scripted field is updated when the issue is indexed.  Transition, comment, edit, move, etc.

Nic - do you have any suggestions to the code listed as it does not appear to work 

Apart from it not explicitly returning a value for the field to work with (as it's pseudo code, or code not intended for a field) what is it doing?

Ah that's good information Nic.  I didnt realize it also fired on comment/edit/move/index.  Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

75 views 0 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you