Maintenance has been taken over by Darko. Please, go to https://www.redmine.org/plugins/computed_custom_field_ng.
This plugin provides a possibility to create a computed custom field.
The value of the computed field can be set by formula.
In formula constructions like cfs[cf_id]
are replaced by IDs of custom fields.
A valid formula is a valid Ruby code executed when a customized object is updated.
To put a field ID in the formula, double-click on an item in the list of available fields.
Plugin's changelog is available here.
This is a new version of the plugin. Since version 1.0.0 it is not compatible with previous versions.
The following constructions in formula %{cf_id}
are no longer supported. Instead use cfs[cf_id]
.
If you need to upgrade from older versions, please check out migration section.
- cfs[cf_id] — must be an ID of existing custom field.
- Be careful with code in a formula, if it would wrong your application can be crashed.
- If a computed custom field was created after creating of a customized object you need to re-save an object to evaluate computations.
- After updating of formula customized objects should be re-saved.
Clone from GitHub
# Latest version
git clone https://github.com/annikoff/redmine_plugin_computed_custom_field.git computed_custom_field
Or download ZIP-archive and extract it into "computed_custom_field" directory.
Run migrations
rake redmine:plugins:migrate
- Navigate to plugin folder.
- Run
git pull
- Run
rake redmine:plugins:migrate
- In computed CF's formulas replace
%{cf_id}
constructions bycfs[cf_id]
.
The plugins supports the following Redmine versions: 4.0.x, 3.4.x, 3.3.x, 3.2.x, 3.1.x, 3.0.x, 2.6.x, 2.5.x.
cfs[1]*2+cfs[2]
# means
# custom_field_value(1) * 2 + custom_field_value(2)
(cfs[1]/3.14).round(2)
if cfs[1].zero?
cfs[2]/2
else
cfs[3]/2
end
# For IssueCustomField
(self.estimated_hours || 0) * 2
# For ProjectCustomField
self.parent_id == 2
# If format of Custom Field is Link
"/projects/#{self.project_id.to_s}/issues/new?issue[subject]=Review+request+[##{self.id.to_s} #{self.subject}]&issue[tracker_id]=3"
# Retrieve a value from Key/value list custom field
cfs[1].try(:id)
To write formulas this documentation can be helpful:
- Issue
- Project
- User
- TimeEntry
- Version
- Group
- Document
- TimeEntryActivity, IssuePriority, DocumentCategory
If you need help with a formula's code read FAQ and check out existing issues or ask Redmine community.
Licensed under the MIT-LICENSE