How to get another ticket description in "Create sub task" script post-function

Hello,

 

I'm working with "Create sub task" script post-function and made automatic change of summary and description by following code in "Additional issue actions" section:

issue.summary = issue.summary + ' Perform initial tuning'
issue.description = 'Please perform initial tuning of a new client.'

This works perfect but I would not like to hardcode issue summary and description but prefer to take it from another ticket (it will be template ticket which is kept in different project). I've tried following code:

issue.summary = issueManager.getIssueObject("FOO-5").summary
issue.description = issueManager.getIssueObject("FOO-5").description

I did the same in Groovy script (with import of IssueManager class) and it works but in script post-function it doesn't work.

Could you advise me how I can get description and summary of other already created issue in "Create sub task" script post-function?

 

1 answer

1 accepted

Looks like I'm able to do it with following code (forgot to import proper classes):

import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor
IssueManager issueManager = ComponentAccessor.getIssueManager()
MutableIssue xIssue = issueManager.getIssueObject("FOO-5")
issue.summary = xIssue.summary
issue.description = xIssue.description

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

233 views 1 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you