I’ve created a custom action in local/lib/RT/Action/MyAction.pm.
When I try to call it from bin/rt-crontool I get an error:
[critical]: Failed to load module RT::Action::MyAction. (RT/Action/MyAction.pm did not return a true value at /rt4/bin/rt-crontool line 304. ) at /rt4/bin/rt-crontool line 306. (/rt4/bin/../lib/RT.pm:394) Failed to load module RT::Action::MyAction. (RT/Action/MyAction.pm did not return a true value at /rt4/bin/rt-crontool line 304. ) at /rt4/bin/rt-crontool line 306.
I also tried adding the Action to the RT GUI list of Actions, and have tried clearing the Mason cache and restarting the web servers to no avail.
How can I tell rt-crontool to see my custom action?
Yes. Here’s the entire contents. It’s just a simple action to remove the owner on a ticket - I couldn’t find a native way to do this, so thought I’d write my own. Basically I copied SetStatus.pm and cut out most of what I didn’t need. For now it’s simple. In the future I might read in a Custom Role as an argument and set the Owner to that instead of Nobody. Baby steps.
package RT::Action::SetOwnerNobody;
use strict;
use warnings;
use base qw(RT::Action);
=head1 NAME
RT::Action::SetOwnerNobody - Action to set owner of a ticket
=head1 DESCRIPTION
This action changes the owner to a new value.
=cut
sub Prepare {
my $self = shift;
return 1;
}
sub Commit {
my $self = shift;
# Set ticket Owner to 'Nobody'
my ( $status, $msg ) = $self->TicketObj->SetOwner( $RT::Nobody->id );
unless ( $status ) {
$RT::Logger->error( "Unable to assign ticket to 'Nobody'. ", $msg);
}
return 1;