Hi, I have a question about custom fields!
I'm using Mantis 1.0.0a1 (and loving it by the way).
Here's my problem, though.
I have a custom enumeration field called "Level Name." I want to use that field in multiple projects, but the catch is that for each project, I need there to be different values (each project will have a different list of levels).
So I thought I'd just make seperate custom fields and add one to each project seperatley, but the problem is, I want to include a "Levels" column on the View All Issues page.
So if I was to add the each "custom_levels" to the "custom_function_default_get_columns_to_view" function in custom_function_api.php, each level name column from all the other projects will show up when viewing all issues for one project in particular.
So my question is, is there a way to make the values of one custom field different for every project... like the way categories are?
Thanks a ton, and keep up the great work!
Different values for custom fields in mutliple projects?
Moderators: Developer, Contributor
Yes, this is possible in 1.0.0a1. Please see the following post in my blog for details about how to do this:
Enumeration Custom Fields with Dynamic Possible Values
http://www.futureware.biz/blog/index.ph ... &tb=1&pb=1
Regards,
Victor
Mantis to Go?
http://www.futureware.biz/mantisconnect
Enumeration Custom Fields with Dynamic Possible Values
http://www.futureware.biz/blog/index.ph ... &tb=1&pb=1
Regards,
Victor
Mantis to Go?
http://www.futureware.biz/mantisconnect
Thank you, Victor. This definetly seems to be what I'm looking for, but I'm having a little trouble understanding where I will actually be defining the possible values, since I would be entering "=mine" instead of the possible values when I create the custom function.
Sorry for the noobie question, and thanks again for the help..
Sorry for the noobie question, and thanks again for the help..
Re: Different values for custom fields in mutliple projects?
I know this is an old thread, but I didn't find a clear answer to this question anywhere else in the forums. I had exactly the same issue, and I am a newbie to both Mantis and php. In my case, we are working on educational products and need a custom field called Grade Levels. We need different grade ranges of grade levels enumerated for different projects. Here's how I solved it.
In custom_functions_inc.php, I inserted the following function ("Project 1" is the name of one of my projects, and "Project 2" is the name of another one of my projects):
In Mantis, I went to Manage Custom Fields, created a field called Grade Levels, set the Type to Enumeration, and for Values I entered "=grade_levels" (without the quotes). I linked the field to Project 1 and to Project 2.
Now when I go to report an issue for Project 1, the Grade Levels field gives me the choices K, 1, 2, 3, 4, and 5. When I go to report an issue for Project 2, the Grade Levels field gives me the choices 3, 4, 5, and 6. If I have a Project 3 and link the Grade Levels field to it, it will get the default values K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12 because I did not create a project-specific list of values for it. However, I can always edit the function above to add specific values if I wish.
I hope this helps the next newbie that comes along.
In custom_functions_inc.php, I inserted the following function ("Project 1" is the name of one of my projects, and "Project 2" is the name of another one of my projects):
Code: Select all
function custom_function_override_enum_grade_levels() {
$t_project_name = project_get_name( helper_get_current_project() );
switch($t_project_name) {
case "Project 1":
$t_possible_values = "K|1|2|3|4|5";
break;
case "Project 2":
$t_possible_values = "3|4|5|6";
break;
default:
$t_possible_values = "K|1|2|3|4|5|6|7|8|9|10|11|12";
}
return $t_possible_values;
}
Now when I go to report an issue for Project 1, the Grade Levels field gives me the choices K, 1, 2, 3, 4, and 5. When I go to report an issue for Project 2, the Grade Levels field gives me the choices 3, 4, 5, and 6. If I have a Project 3 and link the Grade Levels field to it, it will get the default values K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12 because I did not create a project-specific list of values for it. However, I can always edit the function above to add specific values if I wish.
I hope this helps the next newbie that comes along.
Mantis: 1.1.8
PHP: 5.2.4
SQL: MySQL 5.0.45
OS: XP SP3
PHP: 5.2.4
SQL: MySQL 5.0.45
OS: XP SP3