I am creating a Bug on Bugzilla 5.2+ via rest-API. I try to achieve to set the reporter to a known Bugzilla user which differs from the used API-User.
I already tried that by creating an Extension.pm like follows.
package Bugzilla::Extension::MyExtension;
use strict;
use base qw(Bugzilla::Extension);
our $VERSION = '1.0';
use constant NAME => 'MyExtension';
sub object_end_of_create {
my ($self, $args) = @_;
my $object = $args->{'object'};
if ($object->isa('Bugzilla::Bug')) {
my $user = new Bugzilla::User(3);
$object->{'reporter'} = $user;
$object->{'creator'} = $user;
$object->{'url'} = $user->id;
$object->update;
}
}
__PACKAGE__->NAME;
The extension works, not throwing any errors, but it still does not change any values persistent, especially the reporter. It will, however, display the changed reporter after the bug got transmitted, but will switch back as soon as the page gets reloaded.
Additionally, i would like to get the value for the reporter from my api-request-payload, as i have a relation between the sending client user and the bugzilla user.