Send ticket to other queue from the actions menu

I know how to define actions in RT_SiteConfig.pm like this:

actions => [
’* -> closed’ => {
label => ‘Close’,
update => ‘Respond’,
},

But I need something fancier now. I want to send my ticket to another queue
from the Actions menu. I want this action to be available only from some
statuses in the lifecycle. How can I do this? (I have already configured a
mapping under maps.)

Rinke

I know how to define actions in RT_SiteConfig.pm like this:

 actions => [
     '* -> closed' => {
         label  => 'Close',
         update => 'Respond',
     },

But I need something fancier now. I want to send my ticket to another
queue from the Actions menu. I want this action to be available only from
some statuses in the lifecycle. How can I do this? (I have already
configured a mapping under maps.)
Rinke

You have to use a callback (a file named
local/html/Callbacks/YourOrg/Elements/Tabs/Privileged). Then inside you
have to write your logic to finally add the action to the menu, example:

<%init>
my $request_path = $HTML::Mason::Commands::r->path_info;

Only on ticket pages

if ( $request_path =~ qr{^/Ticket/.*.html} && $m->request_args->{‘id’}
&& $m->request_args->{‘id’} =~ /^\d+$/ ) {

my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
$Ticket->Load( $m->request_args->{'id'} );

# Only if status is FIXME
if ( $Ticket->Status eq 'FIXME' ) {
    my $tabs = PageMenu;
    my $actions = $tabs->child( 'actions' );

    my $Queue = RT::Queue->new( $session{'CurrentUser'} );
    $Queue->Load('YourTargetQueue');

    # Add our custom action here
    $actions->child(
                'sendtoqueueX' => title => loc('Send to queue X'), path =>
                '/Ticket/Display.html?id='.$Ticket->Id.'&Queue='.$Queue->id
                 );
}

}
</%init>

@BPS: would be nice to be able to specify an “url” in Lifecycle actions
with basic replacements (id, …)

Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com

Does this code also actually move the ticket into the other queue?

I’m interested in doing something similar: setting up menu items to quickly
set the ticket’s Starts date to predefined relative future values.On 9 October 2014 18:43, Emmanuel Lacour elacour@easter-eggs.com wrote:

On Wed, Oct 08, 2014 at 11:12:15PM +0200, Rinke Colen wrote:

I know how to define actions in RT_SiteConfig.pm like this:

 actions => [
     '* -> closed' => {
         label  => 'Close',
         update => 'Respond',
     },

But I need something fancier now. I want to send my ticket to another
queue from the Actions menu. I want this action to be available only
from
some statuses in the lifecycle. How can I do this? (I have already
configured a mapping under maps.)
Rinke

You have to use a callback (a file named
local/html/Callbacks/YourOrg/Elements/Tabs/Privileged). Then inside you
have to write your logic to finally add the action to the menu, example:

<%init>
my $request_path = $HTML::Mason::Commands::r->path_info;

Only on ticket pages

if ( $request_path =~ qr{^/Ticket/.*.html} && $m->request_args->{‘id’}
&& $m->request_args->{‘id’} =~ /^\d+$/ ) {

my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
$Ticket->Load( $m->request_args->{'id'} );

# Only if status is FIXME
if ( $Ticket->Status eq 'FIXME' ) {
    my $tabs = PageMenu;
    my $actions = $tabs->child( 'actions' );

    my $Queue = RT::Queue->new( $session{'CurrentUser'} );
    $Queue->Load('YourTargetQueue');

    # Add our custom action here
    $actions->child(
                'sendtoqueueX' => title => loc('Send to queue X'),

path =>

‘/Ticket/Display.html?id=’.$Ticket->Id.’&Queue=’.$Queue->id
);
}
}
</%init>

@BPS: would be nice to be able to specify an “url” in Lifecycle actions
with basic replacements (id, …)


Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com

RT Training November 4 & 5 Los Angeles
http://bestpractical.com/training

Does this code also actually move the ticket into the other queue?

by the fact that it calls the Display.html template with the Queue
attribute. Each time Display.html is called on a ticket, it first
process arguments before displaying the ticket (including the change
results).

I’m interested in doing something similar: setting up menu items to
quickly set the ticket’s Starts date to predefined relative future values.

you can do this with such callback, without any doubt :slight_smile:

Easter-eggs Spécialiste GNU/Linux
44-46 rue de l’Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com