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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

ScriptRunner old project key of moved issue out of the work log

Edited

Hello together, 

we created a project which is used to move unused issues into it because we don't want to grant the right to delete issues for everyone. 

The current problem we have is that we have to get the old issue key from the previous project to see where the issue comes from. We want to solve this with a scripted field which sets the old project key.

I havent seen a functionality to extract the old project key over the work log. 

Maybe someone can help here.

Thank you guys in advance :)

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 06, 2021

The IssueManager has a getAllIssueKeys() method that makes this pretty easy.

You could create a scripted field called "Previous Issue Keys"

And add this script:

import com.atlassian.jira.component.ComponentAccessor
def issueManager= ComponentAccessor.issueManager
def allKeys = issueManager.getAllIssueKeys(issue.id)
return allKeys.findAll{it != issue.key}.join(', ')

If you really want just the project keys, you can use this as the last line:

return allKeys.findAll{it != issue.key}.collect{it.split('-')[0]}.join(', ')
TAGS
AUG Leaders

Atlassian Community Events