Page 1 of 1

Retrieve custom field value from php code

Posted: 13 Jul 2011, 15:40
by Georges___
Hello,

I'm pretty new in Mantis and trying to do some customizations.

I'm writing a custom function (after a bug is created) and would like to retrieve the values of a custom field (Tester in my case, which is an enumeration field).

I can retrieve value of default field by the following code

$t_bug = bug_get($p_issue_id);
$t_priority = $t_bug->priority;

Does someone know how to do ?

Thank you in advance,

Georges.

Ps: sorry if I posted in bad forum section or if the question has already been answered somewhere. I didn't find anything.

Re: Retrieve custom field value from php code

Posted: 15 Jul 2011, 00:48
by monn
use this function declared in custom_field_api.php

Code: Select all

custom_field_get_value( $p_field_id, $p_bug_id );

Re: Retrieve custom field value from php code

Posted: 22 Jul 2011, 10:52
by silmic05
hi,

does this function also work dynamically?
i mean when i'm actually report an issue and change the value in a custom enumeration field,
so that the next custom enumeration field can get the selected data of the previous field and
gets according to this its data dynamically from the database?

i hope my question is intelligible. :)

Re: Retrieve custom field value from php code

Posted: 22 Jul 2011, 13:19
by Lapinkiller
Hello

not sure i have correctly understood your answer but is that you want for example :

2 custom field :
1 - "Country" with values "France, USA, England"
2 - "Town" which will have dynamically values

if you select "France" you will have in the 2nd custom field list towns "Paris, Nantes, Lille" etc
if you select "USA" : "new york, washington, chicago" etc
if you select "England" : "London, Liverpool, manchester" etc

and without sending form ?

so you have to use AJAX no ?