Button that Creates an Approval Ticket

I’m newbie at RT and could use some help. I have created a button for
adding an approval to an existing ticket, but had to resort to some less
than desirable coding practices (hacks) to make it work. There must be a
better way to to do this. If anyone has a better plan please let me
know. I’m using RT3.8.2 on linux.

Thanks,

Conrad

Here is what I have written:

This code is at the end of a local copy of ShowTransaction, this

abuses the ‘Comment’ action.

%# Approval button from wiki.bestpractical.com/view/CreateChildTicket -
CPG 2/09
% if ( $Transaction->Type =~ /^(Create)$/
% && $ENV{‘REQUEST_URI’} !~ /(/Approvals/)/
% && $Ticket->QueueObj->Name =~ /^(MyQueue)$/) {

% }

Custom Condition for MyQueue scrip. This abuses ‘Subject’ to sort

out approval requests. Action is ‘Create Tickets’.

my $result = 0;
if ($self->TransactionObj->Type eq “Comment”
&& $self->TransactionObj->Data =~ /(Approval Requested)$/) {
$result = 1;
}
return($result);

Template for the above. This is from the bestpractical wiki and

works fine.

===Create-Ticket: myapproval
Depended-On-By: TOP
Queue: Ops_Approvals
Type: approval
Owner: gratz
AdminCC: {
my $group_name = ‘Ops_Approvers’;
my $groups = RT::Groups->new( $RT::SystemUser );

$groups->LimitToUserDefinedGroups();
$groups->Limit(
‘FIELD’ => ‘Name’,
‘OPERATOR’ => ‘=’,
‘VALUE’ => $group_name );
$groups->First->Id;

}
Content: A ticket needs your attention. Please approve it so any work
requested may be completed.
ENDOFCONTENT