Wiki source code of Implementing (Free) Templates in JIRA
Version 12.1 by Normann P. Nielsen on 2026/11/15 15:44
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | I've been working on Templating in JIRA, **without spending (a lot) of money** on a plugin for the 2000 user JIRA that I manage at work. | ||
| 2 | |||
| 3 | The first solution was making a TEMPLATE Project and use [[Clone Plus>>https://marketplace.atlassian.com/plugins/org.swift.jira.clone-plus]] for cloning Issues to the real projects, but the main problem is that issues in the TEMPLATE project does not have the specific [[Custom Fields>>https://confluence.atlassian.com/display/JIRA/Adding+a+Custom+Field]] and [[Field Configurations>>https://confluence.atlassian.com/display/AOD/Configuring+Fields+and+Screens]] for the real project, so tempates can be fully filled to a satisfying level before cloning the template issue to a real issue. | ||
| 4 | |||
| 5 | So, in the second attempt, I have created a lot of objects that works "in parallel" of the real isssues, in this case ITIL processes. | ||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 | {{success}}The solution below works with the standard Clone function in JIRA, but is more flexible with the [[Clone Plus>>https://marketplace.atlassian.com/plugins/org.swift.jira.clone-plus]] Plugin, which is not so expensive. | ||
| 10 | |||
| 11 | Especially, check out the possibilities in [[https://bobswift.atlassian.net/wiki/display/JCPP/clone-plus.properties]]{{/success}} | ||
| 12 | |||
| 13 | = Topics = | ||
| 14 | |||
| 15 | {{toc/}} | ||
| 16 | |||
| 17 | = Template Issue Types = | ||
| 18 | |||
| 19 | New Template Issue types created: | ||
| 20 | |||
| 21 | |= Issue Type|= Template Issue Type | ||
| 22 | | Incident| Incident Template | ||
| 23 | | Change| Change Template | ||
| 24 | | Service Request| Service Request Template | ||
| 25 | |||
| 26 | = Workflow = | ||
| 27 | |||
| 28 | Each Template is assigned to a very simple workflow: | ||
| 29 | |||
| 30 | {{diagram reference="Main.atlassian.atlassian-jira.implementing-free-templates-in-jira.simpleworkflow-drawio.WebHome" /}} | ||
| 31 | |||
| 32 | The workflow has no real value, as cloning is always possible, so Its only a signal to the user and the status field can be used in filters. | ||
| 33 | |||
| 34 | = Notifications = | ||
| 35 | |||
| 36 | The workflow and Notifications is sending (virtually) no notifications at all, as this is pointless, so on Post functions the "Generic Event" is replaced with a new event "No Notifications" I have implemented under "Events" and "Notification Schemes" | ||
| 37 | |||
| 38 | = Screens = | ||
| 39 | |||
| 40 | As the template are created in real projects, all fields and field-configurations (and components) are present with the Template are created. | ||
| 41 | |||
| 42 | But, in the template we dont want some specific fields present, that are not relevant until cloning the Template to a real issue - typical **Date** and **Person-related** fields, so each Template has its own Screen Scheme and Sceen: | ||
| 43 | |||
| 44 | |= Issue Type|= Screen | ||
| 45 | | Incident| Incident Screen | ||
| 46 | | Incident Template| Incident Template Screen | ||
| 47 | | Change| Change Template | ||
| 48 | | Change Template| Change Template Screen | ||
| 49 | | Service Request| Service Request Screen | ||
| 50 | | Service Request Template| Service Request Template Screen | ||
| 51 | |||
| 52 | Looking like this in JIRA: | ||
| 53 | |||
| 54 | [[image:Screen Shot 2014-06-05 at 08.54.07.png||width="700"||alt="Screen Shot 2014-06-05 at 08.54.07.png"]] | ||
| 55 | |||
| 56 | with Operation(s): | ||
| 57 | |||
| 58 | [[image:Screen Shot 2014-06-05 at 08.55.32.png||width="900"||alt="Screen Shot 2014-06-05 at 08.55.32.png"]] | ||
| 59 | |||
| 60 | A sample for the Incident Screens: | ||
| 61 | |||
| 62 | {{diagram reference="Main.atlassian.atlassian-jira.implementing-free-templates-in-jira.screens-drawio.WebHome" /}} | ||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | {{error}}A lesson learned the hard way here: Field not on the screen is not the same as the field being empty or none existing. Thus, cloning an "Inciden"t to an "Incident Template" will copy all fields, but they cant be seen afterwards.{{/error}} | ||
| 67 | |||
| 68 | = Filters = | ||
| 69 | |||
| 70 | In general, filters should exclude the "* Template" issuetypes. | ||
| 71 | |||
| 72 | = Using Templates = | ||
| 73 | |||
| 74 | I use the templates in 2 ways - cloning them from a JIRA Dashboard and referencing them from Documentation in Confluence: | ||
| 75 | |||
| 76 | === JIRA Dashboard === | ||
| 77 | [[image:Screen Shot 2014-06-05 at 09.02.51.png||width="900"||alt="Screen Shot 2014-06-05 at 09.02.51.png"]] | ||
| 78 | |||
| 79 | === Documentation in Confluence === | ||
| 80 | Here in the sample, a JIRA JQL selecting the correct "Incident Templates" are shown on the Incident Management Procedure: | ||
| 81 | |||
| 82 | [[image:Screen Shot 2014-06-05 at 09.07.04.png||width="900"||height="616"||alt="Screen Shot 2014-06-05 at 09.07.04.png"]] | ||
| 83 | |||
| 84 | = Enhance Cloning for users = | ||
| 85 | |||
| 86 | For JIRA, I have made a Custom Field of the Type "Message Custom Field (for view)" From the JIRA Toolkit, containing this code as "Default Value": | ||
| 87 | |||
| 88 | |||
| 89 | {{code}} | ||
| 90 | <div class="field-group aui-field-wikiedit comment-input"><a href='' target='_self' id='templatenclone' class='aui-button aui-button-primary aui-style'>Click to Clone</a></div><script>AJS.$(document).bind(JIRA.Events.NEW_CONTENT_ADDED, function(event, dialog) {AJS.$('#templateclone').attr('href','https://myserver.domain/secure/ClonePlusStart!default.jspa?id='+AJS.$('#key-val').attr('rel'));});</script> | ||
| 91 | {{/code}} | ||
| 92 | |||
| 93 | Where the somewhat obscure code | ||
| 94 | |||
| 95 | |||
| 96 | {{code}} | ||
| 97 | AJS.$('#key-val').attr('rel') | ||
| 98 | {{/code}} | ||
| 99 | |||
| 100 | Get the Issue ID in the database. Inprovements here could be nice! | ||
| 101 | |||
| 102 | Rendering on the "Incident Template" Screen, the Custom Field looks like (See [[Making a ADG like button>>Main.atlassian.atlassian-jira.making-a-adg-like-button]]): | ||
| 103 | |||
| 104 | [[image:Screen Shot 2014-06-05 at 16.04.15.jpg||width="460"||height="585"||alt="Screen Shot 2014-06-05 at 16.04.15.jpg"]] |