When creating a subtask in Redmine you may want it to automatically inherit certain values from the parent task. Here I will explain step by step how to achieve this.
What details to inherit
Let's assume we want the child task to inherit
- subject
- description
- version
from the parent task.
Install View customize plugin
If you follow these Redmine Pills you have already noticed that I use View customize plugin for many purposes. This is one of my favourite Redmine plugins. It is my Swiss Army knife 😉
Create a new View
Go to Administration > View customize and create a “New view customize” as follows:
Path pattern: .*
Project pattern: include project identifier in case you only want this code to apply to a certain project
Insertion position: Bottom of issue detail
Type: Javascript
Code (copy/paste):
$(function() {
var addLink = $('#issue_tree a[href*="/issues/new"]')[0];
var subject = $('#issue_subject').val();
if (subject) {
addLink.href += '&issue%5Bsubject%5D=' + encodeURIComponent(subject);
}
var description = $('#issue_description').val();
if (subject) {
addLink.href += '&issue%5Bdescription%5D=' + encodeURIComponent(description);
}
var version = $('#issue_fixed_version_id').val();
if (version) {
addLink.href += '&issue%5Bfixed_version_id%5D=' + version;
}
})
Comment: Subtask inherit subject, description and version
Enabled: yes
Private: no
Here's a video with the result:
Hola
Necesito heredar un campo personalizado… intento con el siguiente codigo pero no funciona
var cf_31 = $(‘#issue_custom_field_values_31’).val();
if (cf_31) {
addLink.href += ‘&issue%5Bcustom_field_values_31%5D=’ + cf_31;
}
gracias
Encontré la forma: issue[custom_field_values][31]
saludos!
Perfecto, gracias por la información.