When a ticket is moved from one queue to another, is that ticket “created” in the new queue? I am trying to have a script set up so that when a ticket is moved to another queue, a notification is sent out. I’ve tried just about every combination and still no luck. Is there a way to do this? Thanks in advance.
When a ticket is moved from one queue to another, is that ticket
“created” in the new queue? I am trying to have a script set up so
that when a ticket is moved to another queue, a notification is sent
out.
A ticket is created only once, moving between queues is a different type
oft transaction. So, basically, you need a ScripCondition which triggers
on this transaction type. I think there was one in contrib for rt2, not
sure whether there is for rt3.
Sebastian
Sebastian Flothow
sebastian@flothow.de
Because it reverses the logical flow of conversation.
Why is top posting frowned upon?
Use the condition On Queue Change (I think this comes with the standard
installation, otherwise I can post the one I use).
As ScripAction, you can use the following (mails everyone with right
SeeQueue on that queue (the queue that the ticket is moved to)
You probably want to insert into the database as well, table ScripActions.
/lib/RT/Actions/NotifyQueue.pm:
package RT::Action::NotifyQueue;
require RT::Action::SendEmail;
use strict;
use vars qw/@ISA/;
@ISA = qw(RT::Action::SendEmail);
{{{ sub SetRecipients
=head2 SetRecipients
Sets the recipients of this message to this ticket’s Requestor.
=cut
sub SetRecipients {
my $self=shift;
my $QueueObj = $self->TicketObj->QueueObj;
my $Users = new RT::Users($QueueObj->CurrentUser);
$Users->WhoHaveRight(Right => 'SeeQueue',
Object => $QueueObj);
my @UserList = @{ $Users->ItemsArrayRef };
while (my $UserObj = shift @UserList) {
push @{ $self->{'To'} },$UserObj->EmailAddress;
}
return (1);
}
}}}
{{{ sub SetReturnAddress
=head2 SetReturnAddress
Set this message’s return address to the apropriate queue address
=cut
sub SetReturnAddress {
my $self = shift;
my %args = ( is_comment => 0,
@_
);
my $replyto;
if ($args{'is_comment'}) {
$replyto = $self->TicketObj->QueueObj->CommentAddress ||
$RT::CommentAddress;
}
else {
$replyto = $self->TicketObj->QueueObj->CorrespondAddress ||
$RT::CorrespondAddress;
}
unless ($self->TemplateObj->MIMEObj->head->get('From')) {
my $friendly_name = $self->TicketObj->QueueObj->Description ||
$self->TicketObj->QueueObj->Name;
$friendly_name =~ s/"/\\"/g;
$self->SetHeader('From', "\"$friendly_name\" <$replyto>");
}
unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) {
$self->SetHeader('Reply-To', "$replyto");
}
}
}}}
eval “require RT::Action::NotifyQueue_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/NotifyQueue_Local.pm});
1;
Cheers,
Jonas
Sebastian Flothow wrote: