i am currently trying to develop a custom module for the Generic Agent, but i could use some help with that. I am trying to accomplish: When a ticket is created by a customer it is saved in the queue "Dispatch". Then the GenAgent should move this ticket into the next queue and assign an owner. This owner would be determined by the value of a dynamic field, visible in the ticket. And i need a seperate module for this, because i have about 130 possible new owners for the tickets.
Question no.1: As i am completly new to Perl, is this code gonna do the job? If not, whats my mistake?
Code: Select all
package Kernel::System::GenericAgent::DispatchCustomerTickets;
use strict;
use warnings;
sub new {
my ( $Type, %Param ) = @_;
my $Self = {};
bless( $Self, $Type );
for (qw(DBObject ConfigObject MainObject EncodeObject TicketObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
my %ticket;
my $dynField;
my $newOwner;
%ticket = $Self->{TicketObject}->TicketGet(
%Param,
DynamicFields => 1,
);
$dynField = %ticket->DynamicField_Description;
if ($dynField eq '0004') {
$newOwner = 'kleinst';
} elsif ($dynField eq '0005') {
$newOwner = 'aunw';
..... some more
} else {
$newOwner = 'schneider';
}
$Self->{TicketObject}->TicketQueueSet(
TicketID => $Param{TicketID},
Queue => 'Support',
);
$Self->{TicketObject}->TicketQueueSet(
TicketID => $Param{TicketID},
NewUser => $newOwner,
);
return 1;
}
1;
Question no.2: How do i proceed, once the module is ready? I have read, that i have to add an entry for it in the Kernel/Config/GenericAgent.pm Is that everything?
Thanks for any help i can get.