Apps documentation
Issue Templates for Jira
Server/Data Center Cloud
Issue Templates for Jira

Server/Data Center

Cloud

8.x
7.x
FAQ
Release notes
Last updated May 25, 2020

Groovy

This section provides information on Groovy integration.

You can obtain the id of the used template in Groovy using provided service as on the code below.
All scripts has been tested on ScriptRunner 4.3.12.

Note

Remember to add the annotation @WithPlugin("com.intenso.jira.issue-templates") to use Issue Templates for Jira app.

import pl.intenso.it.utils.export.PublicTemplateSevice
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.component.ComponentAccessor
 
 
@WithPlugin("com.intenso.jira.issue-templates")
def publicTemplateSevice = ComponentAccessor.getOSGiComponentInstanceOfType(PublicTemplateSevice.class)
  
def templateIdByKey = publicTemplateSevice.getAppliedTemplateIdByIssueKey("IT-100");
def templateIdById = publicTemplateSevice.getAppliedTemplateIdByIssueId(10100L);

Below version 6.4.2

import pl.intenso.it.utils.export.AppliedTemplateSevice
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.component.ComponentAccessor
@WithPlugin("com.intenso.jira.issue-templates")
def appliedTemplateSevice = ComponentAccessor.getOSGiComponentInstanceOfType(AppliedTemplateSevice.class)
  
def templateIdByKey = appliedTemplateSevice.getAppliedTemplateIdByIssueKey("IT-100");
def templateIdById = appliedTemplateSevice.getAppliedTemplateIdByIssueId(10100L);

Apply template with Copy set of fields


import pl.intenso.it.utils.export.PublicTemplateSevice
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue;
 
@WithPlugin("com.intenso.jira.issue-templates")
def publicTemplateSevice = ComponentAccessor.getOSGiComponentInstanceOfType(PublicTemplateSevice.class)
   
MutableIssue issue = issue
publicTemplateSevice.applyTemplateToIssue("TEMP-4", issue);

Copy sub-tasks from template


import pl.intenso.it.utils.export.PublicTemplateSevice
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue;
 
@WithPlugin("com.intenso.jira.issue-templates")
def publicTemplateSevice = ComponentAccessor.getOSGiComponentInstanceOfType(PublicTemplateSevice.class)
   
MutableIssue issue = issue
publicTemplateSevice.copySubtasksFromTemplate("TEMP-4", issue, "", null); //Template, current issue, stages and extra due date value

Need help?

If you can’t find the answer you need in our documentation, raise a support request*.

*Include as much information as possible to help our support team resolve your issue faster.