Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
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

Change assignee from issue to linked issue.

I'm trying to set up an automatic Assignee change in related tasks.
If Reporter is changed in a task, in some related tasks, I need to change Assignee to Reporter in the main task.
Is there an example of a trigger in Script runner that performs this functionality?

2 answers

1 accepted

0 votes
Answer accepted
Salzi
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.
Oct 13, 2023

Hi @Max ,
do a custom script listener in Scriptrunner for the event issue updated and then filter whether the reporter has changed.

With HAPI you can easily set the assignee. Here's an example:

def issue = Issues.getByKey('IS1-6')

def orgIssueReporter = issue.getReporter()

log.warn(orgIssueReporter)

def linkedIssues = issue.getOutwardLinks()

linkedIssues.each { it ->
def linkedIssue = it.destinationObject
linkedIssue.update{
setAssignee(orgIssueReporter)
}
}

Thanks for the example.
I can't understand why I get an error in one case and an empty list of related tasks in the other case.

The script is like this:

def issue = event.getIssue()
def issueKey = issue.getKey()


//def issue = Issues.getByKey('JIRA166-163')
def issueSummary = issue.getSummary()
def orgIssueReporter = issue.getReporter()
def linkedIssues = issue.getOutwardLinks()

log.warn(issueSummary)
log.warn("Linked issue" + linkedIssues)


linkedIssues.each { it ->
    def linkedIssue = it.destinationObject
    log.warn("Linked issue 2" + linkedIssues)
    linkedIssue.update{
       setAssignee(orgIssueReporter)
    }
JIRA-163 issue.PNGJIRA-163.PNGJIRA-164 issue.PNGJIRA-164 trigger.PNG
Salzi
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.
Oct 17, 2023

Hi @Max ,

In one example, the user does not have permission to be an assignee in this project.
And on the other hand, you would have to add the InwardLinks to the linkedIssues (unfortunately there is no function in HAPI that gets all the links). You can simply add both lists together:

def linkedIssues = issue.getOutwardLinks() + issue.getInwardLinks()

Hi @Salzi, Thank you, for your help. It's working.

0 votes
Craig Nodwell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 13, 2023

Hi @Max this can be done, but can you be a little more clear on the ask.  Why would a reporter change?  

This is how the process is structured. From one project, related tasks are automatically created in other projects. And Reporter is responsible for them. If a task is transferred to another employee, then all related tasks are also transferred to him.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events