Project

General

Profile

Plugins Directory » Redmine Depending Custom Fields

Author: Jan Catrysse
Website: https://github.com/jcatrysse/redmine_depending_custom_fields
Code repository: https://github.com/jcatrysse/redmine_depending_custom_fields.git
Registered on: 2025-06-26 (about 2 months ago)
Current version: 0.0.4
Compatible with: Redmine 6.1.x, 6.0.x, 5.1.x
User ratings:   (1)

Redmine Depending Custom Fields

ATTENTION: ALPHA STAGE

This plugin provides depending / cascading custom field formats for Redmine. Two new field formats (List (depending) and Key/Value list (depending)) are introduced in addition to the Extended user field format with options for group-based filtering and visibility of active, registered or inactive users.

Features

  1. User custom field
    1. Filter users by Redmine groups
    2. Optionally exclude administrators
    3. Choose to display active, registered and/or inactive users
    4. Users are listed under headers for active, registered and inactive status in filters
  2. Depending or Cascading custom fields
    1. Both for lists as key/value pairs
    2. New formats List (depending) and Key/Value list (depending) allow defining parent/child relationships
    3. Parent lists can depend on other lists or depending lists of the same object type
    4. Key/value lists can depend on enumerations or depending key/value lists of the same object type
    5. Parent and Child relationships between fields
    6. Relation between Parent and Child values is configurable in a matrix
    7. Child fields include a blank option to deselect and are disabled until a parent value is chosen
    8. Descendant fields update automatically when parents are cleared and only show the allowed options
    9. Works on all objects that support custom fields such as issues, projects, time entries, versions and users
  3. Bulk edit
    1. New custom field types can be used when editing multiple issues at once
    2. Allowed values are calculated across all selected issues so only valid options remain available
    3. Javascript behaviour ensures only allowed values are selectable when parent fields change
    4. Invalid combinations submitted via API or email are rejected server-side
    5. "None" can be chosen to clear a value while bulk editing
    6. Selecting "None" for a parent field automatically clears all of its dependent fields
    7. Choosing a value for a parent field hides the "No change" option on all of its descendants so invalid values can't be kept

Context menu wizard

Open the context menu on an issue list (right-click or the menu button) to access the wizard. Users who have the Edit issues permission will see a menu entry for each parent custom field that is valid for all selected issues. Choosing one of these entries expands the menu in place and shows cascading select boxes with a save button. Child fields are hidden from the normal menu so dependencies cannot be broken. The selected value is stored for every chosen issue once you click Save.

Compatibility

The plugin is tested with Redmine 5.1 and should work with later versions.

Development

Tests can be run using:

RAILS_ENV=test bundle exec rspec plugins/redmine_depending_custom_fields/spec

API

The plugin exposes a JSON API to read and modify the configuration of list, enumeration and depending custom fields. Each endpoint returns all attributes you normally configure in the Redmine GUI, such as name, description, required flag, visibility, trackers and projects as well as the dependency mapping.
The following endpoints are available:

  • GET /depending\_custom\_fields – list supported custom fields
  • GET /depending\_custom\_fields/\:id – show a single custom field with its dependencies
  • POST /depending\_custom\_fields – create a new custom field
  • PUT /depending\_custom\_fields/\:id – update an existing custom field
  • DELETE /depending\_custom\_fields/\:id – remove a custom field

Responses contain the custom field attributes listed above including parent\_custom\_field\_id, the possible values and the mapping of allowed child values per parent option. Parameters use the same types as in Redmine:

  • booleans for flags like is\_required, is\_filter, searchable, multiple, is\_for\_all and visible (set visible to false and provide role\_ids to restrict visibility to specific roles)
  • arrays of integers for tracker\_ids, project\_ids and role\_ids
  • arrays of strings for possible\_values
  • default\_value when no parent\_custom\_field\_id is set
  • hashes for value\_dependencies and default\_value\_dependencies
  • enumeration definitions in the enumerations array when using enumeration fields

Example usage

List all configured fields:

curl -H "X-Redmine-API-Key: <TOKEN>" \
  https://redmine.example.com/depending_custom_fields.json

Create a depending list field without a parent:

curl -X POST -H "Content-Type: application/json" \
  -H "X-Redmine-API-Key: <TOKEN>" \
  -d '{
    "custom_field": {
      "name": "Severity",
      "type": "IssueCustomField",
      "field_format": "depending_list",
      "possible_values": ["Minor", "Major"],
      "default_value": "Minor" 
    }
  }' \
  https://redmine.example.com/depending_custom_fields.json

Create a new depending list field linked to a parent field with id 5:

curl -X POST -H "Content-Type: application/json" \
  -H "X-Redmine-API-Key: <TOKEN>" \
  -d '{
    "custom_field": {
      "name": "Subtype",
      "type": "IssueCustomField",
      "field_format": "depending_list",
      "possible_values": ["Minor", "Major"],
      "is_required": true,
      "is_filter": true,
      "searchable": true,
      "visible": true,
      "multiple": false,
      "url_pattern": "https://tracker.example.com/%value%",
      "edit_tag_style": "select",
      "tracker_ids": [1,2],
      "project_ids": [3],
      "role_ids": [4,5],
      "parent_custom_field_id": 5,
      "value_dependencies": {"1": ["Minor"], "2": ["Major"]},
      "default_value_dependencies": {"1": "Minor", "2": "Major"}
    }
  }' \
  https://redmine.example.com/depending_custom_fields.json

Update dependencies for an existing field:

curl -X PUT -H "Content-Type: application/json" \
  -H "X-Redmine-API-Key: <TOKEN>" \
  -d '{
    "custom_field": {
      "tracker_ids": [1],
      "value_dependencies": {"1": ["Bug", "Feature"]}
    }
  }' \
  https://redmine.example.com/depending_custom_fields/7.json

Update dependencies and add a value (Critical):

curl -X PUT -H "Content-Type: application/json" \
  -H "X-Redmine-API-Key: <TOKEN>" \
  -d '{
    "custom_field": {
      "possible_values": ["Minor", "Major", "Critical"],
      "value_dependencies": {
        "Parent value 1": ["Minor"],
        "Parent value 2": ["Major"]
      }
    }
  }' \
  https://redmine.example.com/depending_custom_fields/7.json

Depending enumeration example

Fetch a depending enumeration field:

curl -H "X-Redmine-API-Key: <TOKEN>" \
  https://redmine.example.com/depending_custom_fields/9.json

Create a new depending enumeration field that depends on a parent field with id 8:

curl -X POST -H "Content-Type: application/json" \
  -H "X-Redmine-API-Key: <TOKEN>" \
  -d '{
    "custom_field": {
      "name": "Detailed activity",
      "type": "TimeEntryCustomField",
      "field_format": "depending_enumeration",
      "enumerations": [
        {"name": "Research", "position": 1},
        {"name": "Testing", "position": 2}
      ],
      "is_required": true,
      "is_filter": true,
      "searchable": true,
      "visible": false,
      "multiple": false,
      "tracker_ids": [1],
      "project_ids": [3],
      "role_ids": [4,5],
      "parent_custom_field_id": 8,
      "value_dependencies": {"1": ["2"]},
      "default_value_dependencies": {"1": 2}
    }
  }' \
  https://redmine.example.com/depending_custom_fields.json

Update the dependencies of that enumeration field:

curl -X PUT -H "Content-Type: application/json" \
  -H "X-Redmine-API-Key: <TOKEN>" \
  -d '{
    "custom_field": {
      "enumerations": [
        {"id": 1, "name": "Research", "position": 1},
        {"name": "Implementation", "position": 2},
        {"id": 2, "_destroy": true}
      ],
      "value_dependencies": {"1": ["2"]}
    }
  }' \
  https://redmine.example.com/depending_custom_fields/9.json

Using depending fields via incoming email

Example snippet showing a parent and child custom field:

Parent Field: Hardware
Child Field: Keyboard

Invalid combinations are rejected just like when using the API.

Thank you

Many thanks to ChatGPT for helping to create this plugin.

License

This plugin is released under the GNU GPL v3.

Installation notes

Installation

  1. Copy this plugin directory into plugins of your Redmine installation.
  2. Run bundle install if required and migrate plugins with: bundle exec rake redmine:plugins.
  3. Copy plugin assets: bundle exec rake redmine:plugins:assets.
  4. Restart Redmine.

Changelog

0.0.4 (2025-08-04)

Compatible with Redmine 6.1.x, 6.0.x, 5.1.x.

  • Improve Redmine 6.0 compatibility
  • Make default values configurable with parent / child relations

0.0.3 (2025-07-15)

Compatible with Redmine 6.1.x, 6.0.x, 5.1.x, 5.0.x.

  • Handle depending fields via Redmine mail handler
  • Invalid combinations submitted via API or email are rejected server-side

0.0.2 (2025-07-07)

Compatible with Redmine 6.1.x, 6.0.x, 5.1.x, 5.0.x.

  • Add a Context menu
  • Refactor and optimize code

0.0.1 (2025-06-26)

Compatible with Redmine 6.1.x, 6.0.x, 5.1.x, 5.0.x.

User ratings

  by Jaebok Oh 27 days ago

Great Plugin!!