Hi folks,
Thought I would give it a shot on this list. I got a
problem with a custom TicketCreate module that I’m working on.
Basically, what I want to do is on a TicketCreate is send a NewTicket
notification to all the agents that has selected the queue the ticket is
assigned to as “My Queues” even if the ticket was assigned an
owner. Of course this is built right into OTRS for tickets that are
unlocked, but we sometimes use OTRS to log simple tasks and assign the ticket
to ourselves. So I have this working… see below. However, the
only problem that I have is the notification itself contains no information
other than the queue it is. It’s missing the customer info, the
article body… all the good stuff. I’m thinking that maybe the
article has not been created yet and it’s an order thing? I’m
not very Perl savvy so any help would be greatly appreciated!
#########################################################################################
package Kernel::System::Ticket::Event::EmailHelpDeskSuper;
use strict;
use Kernel::System::User;
use Kernel::System::Email;
use Kernel::System::Queue;
use vars qw($VERSION);
$VERSION = '$Revision: 1.4 $';
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
sub new {
my $Type = shift;
my %Param = @_;
# allocate new hash for object
my $Self = {};
bless ($Self, $Type);
# check needed objects
foreach (qw(DBObject ConfigObject
LogObject TicketObject)) {
$Self->{$_} =
$Param{$_} || die "Got no $_!";
}
# 0=off; 1=on;
$Self->{Debug} = $Param{Debug} || 1;
$Self->{UserObject} =
Kernel::System::User->new(%Param);
$Self->{EmailObject} =
Kernel::System::Email->new(%Param);
$Self->{QueueObject} =
Kernel::System::Queue->new(%Param);
return $Self;
}
sub Run {
my $Self = shift;
my %Param = @_;
# get ticket data
my %Ticket =
$Self->{TicketObject}->TicketGet(%Param);
# check needed stuff
foreach (qw(TicketID Event Config)) {
if (!$Param{$_})
{
$Self->{LogObject}->Log(Priority => 'error', Message => "Need
$_!");
return;
}
}
if ($Param{Event} eq 'TicketCreate') {
my %Ticket =
$Self->{TicketObject}->TicketGet(TicketID => $Param{TicketID});
#if
($Ticket{State} eq 'New') {
# get agentss who
are sucscribed the ticket queue to the custom queues
my @UserIDs =
$Self->{TicketObject}->GetSubscribedUserIDsByQueueID(
QueueID => $Ticket{QueueID},
);
# send each
agent the a notification
foreach my
$UserID (@UserIDs) {
my %User =
$Self->{UserObject}->GetUserData(UserID => $UserID, Valid => 1);
if (%User) {
# send agent notification
$Self->{TicketObject}->SendAgentNotification(
Type => 'NewTicket',
UserData => \%User,
CustomerMessageParams => \%Param,
TicketID => $Param{TicketID},
UserID => 1,
);
}
elsif ($Param{Event} eq 'MoveTicket') {
my %Ticket =
$Self->{TicketObject}->TicketGet(TicketID => $Param{TicketID});
# do some stuff
}
}
}
return 1;
}
1;
######################################################################################################################
Daniel
Shue
Networking
Engineer
Randolph
County IT Department
725
McDowell Rd
Asheboro,
NC 27203
Phone:
(336) 318-6399
Fax:
(336) 636-7699
Daniel
Shue
Networking
Engineer
Randolph
County IT Department
725
McDowell Rd
Asheboro,
NC 27203
Phone:
(336) 318-6399
Fax:
(336) 636-7699