Extending user profiles with additional data

In the spirit of flexibility, Redmine lets users customize various objects inside the application. The objects can be: user, group, project, activity, version, document, spent time, issue priority, or document category. This recipe applies to any object.

Note

The custom fields feature is extremely important. It lets users customize Redmine to fit various purposes.

For example, you can change the type of tracker from Bug to Virtual server and extend this tracker with custom fields, such as RAM or Disk size, and keep track of your virtual servers. Then, you can use filtering features to find all the servers using Windows or any other custom fields that you figured out you need in your Redmine implementation.

Getting ready

Make sure that you have administrative permissions on the Redmine system. If you have them, the Administration menu item will be visible at the top left, prior to the Help link.

How to do it…

To create new custom field for User, perform the following steps:

  1. Click Administration, then click Custom fields, and click New custom field.
  2. Select Users and click Next. The New custom field entry form should be displayed, as follows:
  3. Choose a type of field from the Format drop-down. The name of the field, in this case, is Phone number, but this can be birth date, educational degree, home address, or whatever you need. Fields such as Min-Max and Regular expression depend upon the format of the custom field. Options on the right, such as Required, Visible, Editable, or Used as a filter are type independent.
  4. Click the Save button at the bottom of the form.

Test custom fields by navigating to My account. You should get the Phone number field, as displayed in the following image, and it is a required field:

From now on, every new user added to Redmine, existing users trying to modify their account, or an administrator trying to modify their account, will have to enter a Phone number as it is a required field. Redmine won't let them save changes or register unless a properly formatted value is entered to the Phone number field.

How it works…

This feature extends built-in Redmine objects with custom fields. Technically, it works by adding custom attributes related to objects that are represented by tables in the database, and data is managed through various forms used in many places inside the Redmine application. From the management side, this feature works by adding a new value to built-in Redmine objects. Particularly in this recipe, we extended the User object with a new required field called Phone number, and we made it a mandatory field that needs to satisfy certain rules that are defined by a regular expression and min-max characters, as displayed in Step 3 of the How to do it… section. Later, we demonstrated how this field is used on My account.

There's more…

This recipe can be applied to projects, activities, and issues, as explained at beginning of the recipe. If you are extending issues with additional fields and tick the Used as a filter option, then your custom field will be displayed in the Issues Filters form, as displayed in the following screenshot:

Here, Test is a custom field that is created for Issues.

See also

Refer to the recipes in Chapter 10, Making the Most of Redmine.