Sometimes you would need Redmine to show a user field in the issue page. For instance: what is the user department of the issue's author?
This is something we can achieve with a very useful plugin: Computed Custom Fields plugin
Step 1: Install Computed Custom Fields plugin
Go to its repo on Github, grab the plugin and install it in your Redmine instance following the standard procedure for a plugin installation.
When you install the plugin, you will see three new fields when creating a new custom field:
Please take note that although the plugin states that it is only compatible until Redmine 4.0., I have tested it in Redmine's 4.2. version and it works properly. Also remember to make a database dump before installing any plugin!
Step 2: Create the user custom field
Go to Administration > Custom fields > New user custom field and create it. For instance you can create a list custom field called “Department” and indicate several values, e.g. Dept X, Dept Y…
Step 3: Create the computed issue custom field
Go to Administration > Custom fields > New issue custom field and create a text custom field. Called it differently from the user custom field (for instance User Dept.) so that you always know which field are you working with.
Check the option “Computed”, so that we can use the formula to obtain the user department.
In the “Formula” field insert the following code:
user = author # or user = assigned_to if user.present? dep_cf_id = 11 user.custom_field_value(dep_cf_id) end
Important: change #11 by your user custom field id.
Step 4: Check the values in the issue
Now when you create a new issue, you will not see the new issue custom field in the issue form, because it is a calculated field. You will see the value in the issue page after creating the issue.
Although calculated this field is a common issue field. This means that you will be able to filter by this field or to show it as a column in the issue lists, as any other issue fields.
Has this post been useful to you? Share it on social networks. Thanks a lot.