Retrieve custom field value from php code

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
Georges___

Retrieve custom field value from php code

Post 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.
monn
Posts: 17
Joined: 16 Feb 2011, 03:20

Re: Retrieve custom field value from php code

Post by monn »

use this function declared in custom_field_api.php

Code: Select all

custom_field_get_value( $p_field_id, $p_bug_id );
silmic05
Posts: 6
Joined: 21 Jul 2011, 07:46

Re: Retrieve custom field value from php code

Post 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. :)
Lapinkiller
Posts: 408
Joined: 28 Jan 2011, 18:47
Location: France
Contact:

Re: Retrieve custom field value from php code

Post 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 ?
Lapinkiller,
French PHP developer
New look for your mantis : http://www.mantisbt.org/forums/viewtopi ... =4&t=20055
Post Reply