"Forward" to 3rd party patch

Here are three patches (sorry, Perforce won’t let me easily combine them into
a single patch) which apply with -p2 to an RT source tree to add the "Forward"
action to each transaction. This allows you to forward a transaction onto a
third party. If the third party happens to have permission to correspond on
the ticket, then they’ll be able to reply straight back into RT.

It also needs an entry in the scripconditions table and one in the
scripactions table:

scripactions 
    name       : ForwardToThirdParty
    description: Forward to a third party
    execmodule : SendToThirdParty

scripconditions
    name                : OnForward
    description         : Forwarding to third party
    execmodule          : AnyTransaction
    applicabletranstypes: Forward

If you don’t know how to do that, you probably don’t want to be playing
with this patch yet. :slight_smile:

CLUELESSNESS:
There are No Stupid Questions,
But There Are a LOT of Inquisitive Idiots
http://www.despair.com

forward1.patch (7 KB)

forward2.patch (649 Bytes)

forward3.patch (638 Bytes)

Hi all,

action to each transaction. This allows you to forward a transaction onto a
third party. If the third party happens to have permission to correspond on
the ticket, then they’ll be able to reply straight back into RT.

Very cool patch that I know a lot of people have been looking for.
However, it doesn’t actually work for me and I’m not seeing any logical
reason why not.

The scripactions and scripconditions tables have been updated, and
indeed, both are visible in Scrips (is this required for Forwarding to
work, by the way? That you need a OnForward condition, with the right
template, etc? Tried it, no effect, indeed, it breaks with not being
able to find the RT::Conditition::Forward module)

The [Forward] tag appears, and indeed, it takes the address in the
update page, but submission returns back to the ticket with no mail
being generated and no updates having taken place (that is, no "Ticket
forwarded by to ")

  • else {
  • } elsif ($args{ARGSRef}->{‘UpdateType’} eq ‘forward’) {

(from Web.pm)

In the latest rt, this syntax has changed slightly:

        } elsif ( $trans_type eq 'Correspond' && $trans_flag >= 0 )

And so on…I’ve tried this in both fashions, in the hopes of getting
forwarding to work, no joy.

  • ( ForwardTo => $args{ARGSRef}->{'ForwardTo'},
    
  •   BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
    
  •   MIMEObj => $Message,
    
  •   TimeTaken => $args{ARGSRef}->{'UpdateTimeWorked'});
    
  • push(@{$args{Actions}}, $Description);
    
  • } else {
    push(@{$args{‘Actions’}}, “Update type was neither correspondence nor comment. Update not recorded”);
    }
    }

Curiously, and perhaps this is where I’m going wrong still, I needed an
additional closing brace within ProcessUpdateMessage() or Apache
wouldn’t start. This makes the relevant bit:

        if ( $trans_type eq 'Comment' && $trans_flag >= 0 ) {
            my ( $Transaction, $Description ) = $args{TicketObj}->Comment(
                CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
                BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
                MIMEObj      => $Message,
                TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
            );
            push ( @{ $args{Actions} }, $Description );
        } elsif ( $trans_type eq 'Correspond' && $trans_flag >= 0 ) { 
        my ( $Transaction, $Description ) = $args{TicketObj}->Correspond(
                CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
                BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
                MIMEObj      => $Message,
                TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
            );
            push ( @{ $args{Actions} }, $Description );
        } elsif ($args{ARGSRef}->{'UpdateType'} eq 'forward') {
            my ( $Transaction, $Description) = $args{TicketObj}->Forward(
             ForwardTo      => $args{ARGSRef}->{'ForwardTo'},
             BccMessageTo   => $args{ARGSRef}->{'UpdateBcc'},
             MIMEObj        => $Message,
             TimeTaken      => $args{ARGSRef}->{'UpdateTimeWorked'});
           push( @{ $args{Actions} }, $Description);
       } else {
        push ( @{ $args{'Actions'} }, "Update type was neither correspondence nor comment nor forward. Update not recorded");
    }

}
}

}

I’ve been staring at the function for a few hours, so I may be missing
something obvious. I’ve also tried the elsif as:

        } elsif ( $trans_type eq 'forward') {

and

        } elsif ( $trans_type eq 'forward' && $trans_flag >=0 ) {

Also, no change in actually forwarding.

Sorry for the braindeadness of the question, I know the solution is
close (and yes, I’ve restarted apache), but not quite close enough.

Any thoughts on the obvious, or non-obvious, would be appreciated. This
is for rt-2-0-13, by the way.

Thanks,

Scott

Hi all,

action to each transaction. This allows you to forward a transaction onto a
third party. If the third party happens to have permission to correspond on
the ticket, then they’ll be able to reply straight back into RT.

Very cool patch that I know a lot of people have been looking for.
However, it doesn’t actually work for me and I’m not seeing any logical
reason why not.

The scripactions and scripconditions tables have been updated, and
indeed, both are visible in Scrips (is this required for Forwarding to
work, by the way? That you need a OnForward condition, with the right
template, etc? Tried it, no effect, indeed, it breaks with not being
able to find the RT::Conditition::Forward module)

Isn’t here missing something like insert_condition_OnForward.pl
containing something like (taken from my own very similar version, so
letter-case can be different;-):

my @ScripConditions = (
{
Name => ‘OnForward’,
Description => ‘When a message is forwarded’,
ApplicableTransTypes => ‘Forward’,
ExecModule => ‘AnyTransaction’,
},

                  );

The [Forward] tag appears, and indeed, it takes the address in the
update page, but submission returns back to the ticket with no mail
being generated and no updates having taken place (that is, no "Ticket
forwarded by to ")

  • else {
  • } elsif ($args{ARGSRef}->{‘UpdateType’} eq ‘forward’) {

(from Web.pm)

In the latest rt, this syntax has changed slightly:

        } elsif ( $trans_type eq 'Correspond' && $trans_flag >= 0 )

And so on…I’ve tried this in both fashions, in the hopes of getting
forwarding to work, no joy.

  • ( ForwardTo => $args{ARGSRef}->{'ForwardTo'},
    
  •   BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
    
  •   MIMEObj => $Message,
    
  •   TimeTaken => $args{ARGSRef}->{'UpdateTimeWorked'});
    
  • push(@{$args{Actions}}, $Description);
    
  • } else {
    push(@{$args{‘Actions’}}, “Update type was neither correspondence nor comment. Update not recorded”);
    }
    }

Curiously, and perhaps this is where I’m going wrong still, I needed an
additional closing brace within ProcessUpdateMessage() or Apache
wouldn’t start. This makes the relevant bit:

        if ( $trans_type eq 'Comment' && $trans_flag >= 0 ) {
            my ( $Transaction, $Description ) = $args{TicketObj}->Comment(
                CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
                BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
                MIMEObj      => $Message,
                TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
            );
            push ( @{ $args{Actions} }, $Description );
        } elsif ( $trans_type eq 'Correspond' && $trans_flag >= 0 ) {
      my ( $Transaction, $Description ) = $args{TicketObj}->Correspond(
                CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
                BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
                MIMEObj      => $Message,
                TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
            );
            push ( @{ $args{Actions} }, $Description );
        } elsif ($args{ARGSRef}->{'UpdateType'} eq 'forward') {
            my ( $Transaction, $Description) = $args{TicketObj}->Forward(
             ForwardTo      => $args{ARGSRef}->{'ForwardTo'},
             BccMessageTo   => $args{ARGSRef}->{'UpdateBcc'},
             MIMEObj        => $Message,
             TimeTaken      => $args{ARGSRef}->{'UpdateTimeWorked'});
           push( @{ $args{Actions} }, $Description);
       } else {
        push ( @{ $args{'Actions'} }, "Update type was neither correspondence nor comment nor forward. Update not recorded");
    }

}
}

}

I’ve been staring at the function for a few hours, so I may be missing
something obvious. I’ve also tried the elsif as:

        } elsif ( $trans_type eq 'forward') {

and

        } elsif ( $trans_type eq 'forward' && $trans_flag >=0 ) {

Also, no change in actually forwarding.

Sorry for the braindeadness of the question, I know the solution is
close (and yes, I’ve restarted apache), but not quite close enough.

Any thoughts on the obvious, or non-obvious, would be appreciated. This
is for rt-2-0-13, by the way.

Thanks,

Scott


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Jan Okrouhly
-----------------------------------------±----okrouhly@civ.zcu.cz—
Laboratory for Computer Science | phone: (420 19) 7491588
University of West Bohemia | location: Univerzitni 22
Americka 42, 306 14 Pilsen, Czech Republic | room: UI404
------------------------------------------73!-de-OK1INC@OK0PPL.#BOH.CZE.EU-

Hi,

able to find the RT::Conditition::Forward module)

Isn’t here missing something like insert_condition_OnForward.pl
containing something like (taken from my own very similar version, so
letter-case can be different;-):

my @ScripConditions = (
{
Name => ‘OnForward’,
Description => ‘When a message is forwarded’,
ApplicableTransTypes => ‘Forward’,
ExecModule => ‘AnyTransaction’,
},

                  );

Yeah, already done that – but my assumption here is that this is really
only necessary if you have a Scrip Action that invokes a Condition. The
patch didn’t include a specific perl module for forwarding, but I see
you’re tying things together a bit differently.

I used:

my @ScripConditions = (
{
Name => ‘OnForward’,
Description => ‘Forwarding to third party’,
ApplicableTransTypes => ‘AnyTransaction’,
ExecModule => ‘Forward’,
},

Which basically reversed the last two items. Perhaps I mis-read the
original post…

Thanks for the potential clue!

Scott

Scott A. McIntyre:

not being able to find the RT::Conditition::Forward module)

Which was part of the patch, wasn’t it?

Anyway, it works for me.

“The Write Many, Read Never drive. For those people that don’t know their
system has a /dev/null already.” - Rik Steenwinkel on Exabyte drives, ASR

Hi,

able to find the RT::Conditition::Forward module)

Isn’t here missing something like insert_condition_OnForward.pl
containing something like (taken from my own very similar version, so
letter-case can be different;-):

my @ScripConditions = (
{
Name => ‘OnForward’,
Description => ‘When a message is forwarded’,
ApplicableTransTypes => ‘Forward’,
ExecModule => ‘AnyTransaction’,
},

                  );

Yeah, already done that – but my assumption here is that this is really
only necessary if you have a Scrip Action that invokes a Condition. The
patch didn’t include a specific perl module for forwarding, but I see
you’re tying things together a bit differently.

I used:

my @ScripConditions = (
{
Name => ‘OnForward’,
Description => ‘Forwarding to third party’,
ApplicableTransTypes => ‘AnyTransaction’,
ExecModule => ‘Forward’,
},

Yup! I think you’ve found it!

Simon’s condition is “applicable” to any transaction and tries to call
unexisting (at least in his pretty nice patch) module Forward.pm.

He does add to Jesse’s transactions a new one, called Forward:
my ($Trans, $Msg, $TransObj) = $self->_NewTransaction( Type => ‘Forward’,

BTW…I did the same…

But my condition is them “applicable” only to Transaction Type 'Forward’
and clearly executes existing (nearly void) module AnyTransaction…

Which basically reversed the last two items. Perhaps I mis-read the
original post…

Thanks for the potential clue!

Scott


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Jan Okrouhly
-----------------------------------------±----okrouhly@civ.zcu.cz—
Laboratory for Computer Science | phone: (420 19) 7491588
University of West Bohemia | location: Univerzitni 22
Americka 42, 306 14 Pilsen, Czech Republic | room: UI404
------------------------------------------73!-de-OK1INC@OK0PPL.#BOH.CZE.EU-