How to add Custom field on view issues

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
sumesh786
Posts: 1
Joined: 09 Feb 2007, 11:16

How to add Custom field on view issues

Post by sumesh786 »

i need to add a custom field on view issues page...how to do that
ed
Posts: 143
Joined: 14 Feb 2005, 02:04
Location: Sydney, Australia

Post by ed »

hmackiernan
Posts: 18
Joined: 17 Feb 2006, 19:23
Location: San Francisco, CA

Post by hmackiernan »

Hi Sumesh:
Please note also that in addition to the steps ed refers you to,
to get your custom fields to actually appear on the view issues page, you will need to customize the 'get issues to view' function
to include your new custom filed (at least in 1.0.6 -- I believe 1.1 has a
simpler method for this)

- create custom_functions_inc.php, if it does not already exist
- copy the function custom_function_default_get_columns_to_view
which resides in core/custom_function_api.php into your new
custom_functions_inc.php, _*renaming*_ the function from _default_
to _override_, that is name it custom_function_override_get_columns_to_view
- in the body of the function, there are two branches, one for each 'target' view, that is one for the CSV export and one for the View Issues page.
in the section for COLUMNS_TARGET_VIEW_PAGE, add your new
custom field to the list, in the position you want it to appear, by assigning
it to $t_columns[].
- note that you must prefix your custom field with 'custom' == so to be concrete, if I've added a new field named 'sock_color' I would add the following line:
$t_columns[] = 'custom_sock_color'; // sock color
amongst the other fields already there.

---

Additionally (almost done) You should add a custom string to be the column heading for your custom field, by default Mantis will just write the
column name for the heading. To add this string, edit $custom_strings_inc.php (which should exist if you follow the instructions sam points out since you probably added a label for your field) and add:
$s_sock_color = "Sock Color"

----
Hope this helps

Regards,
h MacKiernan
Post Reply