Page 1 of 1

Change Value of Custom Field in Plugin

Posted: 17 Jan 2020, 22:18
by bluescreenterror
Hi,

I started to write a little plugin which change the value of a custom field (enumeration) when the status is set to resolved.

I got the basic of the plugin and use a hook on the "EVENT_UPDATE_BUG_DATA" event.
Here is my code for the function which is triggered by the hook:

Code: Select all

function bugUpdated($p_issue_id, $p_bug_data, $p_bugnote_text)
    {
	if( $p_bug_data->status == RESOLVED )
	{
	$t_id = custom_field_get_id_from_name('KanBan.Status');
	#$p_bug_data->KanBan.Status = "Ready";	
	#custom_field_set_value( $t_id , $p_issue_id, 'Ready'); 
	}
	return $p_bug_data;
    }
I tryed to use the custom_field_set_value() method to set the value but without effect. I assume I have to manipulate my custom field in the $p_bug_data directly but I dont know how.

Re: Change Value of Custom Field in Plugin

Posted: 19 Jan 2020, 22:28
by bluescreenterror
Ah..I got the solution...the wrong Event to manipulate Custom fields you have to go for the "EVENT_UPDATE_BUG" which is triggered later on bug_update.php