This post is the continuation of:

Now in the second part of the post we want the same thing, but not “hardcoded”. We want to create new tickets based on a description of an existing Jira ticket (and we will use this kind of tickets as templates).

It’s very easy! Just see this code:


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager

IssueManager issueManager = ComponentAccessor.getIssueManager();
def issueobtained = issueManager.getIssueObject("ISSUE_KEY");

def desc = getFieldById("description")
//def defaultValue = """
//
//""".replaceAll(/ /, '')

if (! underlyingIssue?.description) {
desc.setFormValue(issueobtained.description)
}

Just replace ISSUE_KEY with the Key of the Jira ticket that we will use as template (its description field of course)

If we want more, we can save more time and money using the plugin “Description Templates for Jira” and/or “Description Templates for Jira Cloud“. And it’s FREE!

mr.addon-39

Description Templates for JIRA

By MrAddon

Advertisements
Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s