This chapter provides information on how to use Automation and Issue Templates together.
Combining Jira Automation and Issue Template for Jira requires using Automation’s Create Issue action and a custom issue.templates.automation property. You can delegate the job of creating the issue with Automation and apply a template right after the issue has been created with Issue Templates for Jira.
Make sure you have the Allow marketplace apps to apply templates toggle turned on in Advanced (Global configuration). Without this toggle automation doesn’t work.
See Atlassian documentation to learn how to Create an issue with Automation.
{
"properties": [{
"key": "issue.templates.automation",
"value": {
"applyTemplate": "TEMPLATE-1"
}
}]
}
This function instructs Issue Templates for Jira to applyTemplate
with the issue key equal to TEMPLATE-1.
There are numerous triggers that you can use with the Create issue action and apply the template property. You can see some examples in the videos below.
One of available options to create an issue from a template is to use Automation’s Scheduled trigger with Create issue action. Applying a template to a newly created issue is possible only if you change Create issue action’s properties, as shown in the example below:
{
"properties": [{
"key": "issue.templates.automation",
"value": {
"applyTemplate": "TEMPLATE-1"
}
}]
}
TEMPLATE-1 is a template key.
The following example presents required steps in Jira Automation and an external tool (Postman in this case) to create issues from a template.
{{ }}
to set variables.
[ ]
. Read more about variables.{
"properties": [{
"key": "issue.templates.automation",
"value": {
"applyTemplate": "{{webhookData.templateKey}}",
"variables" : "{{webhookData.variables}}"
}
}]
}
{
"templateKey": "PMT-602",
"variables": "{\"externalSystemName\":\"Postman\",\"externalSystemDescription\":\"Great tool to test REST API, cheers!\"}"
}
Result
The issue has been created.
You can pass variables from the webhook using smart values - inside {{ }}
. Use a webhookData object, which has access to the body of the webhook.
Dot can be used to extract nested properties, however, the last element has to be a string or a number.
See the two following examples:
Webhook body:
{
"templateKey": "PMT-602",
"variables": {
"externalSystemName":"Postman",
"externalSystemDescription":"Great tool to test REST API, cheers!"
}
}
Additional fields in Automation:
{
"properties": [{
"key": "issue.templates.automation",
"value": {
"applyTemplate": "{{webhookData.templateKey}}",
"variables" : {
"externalSystemName": "{{webhookData.variables.externalSystemName}}",
"externalSystemDescription": "{{webhookData.variables.externalSystemDescription}}"
}
}
}]
}
Remember that all variables inside {{ }}
need to be basic, for example, a string or a number. You can’t pass an object, therefore it will pass stringified JSON. Issue Templates for Jira will decode such a string.
{
"properties": [{
"key": "issue.templates.automation",
"value": {
"applyTemplate": "{{webhookData.templateKey}}",
"variables" : "{{webhookData.variables}}"
}
}]
}
Additional fields in Automation:
{
"templateKey": "PMT-602",
"variables": "{\"externalSystemName\":\"Postman\",\"externalSystemDescription\":\"Great tool to test REST API, cheers!\"}"
}
For date variables use the supported ISO 8601 format.
Example:
2023-11-10
2023-11-10T11:00
2023-11-10T11:00+0100
If you’re interested in Advanced field editing in Automation, read the official Atlassian documentation.