Generic Agent Execute custom module results in 'Module not found'

Moderator: crythias

Locked
EXG133
Znuny expert
Posts: 217
Joined: 06 Aug 2012, 18:12
Znuny Version: 3.1.7 & 4.04

Generic Agent Execute custom module results in 'Module not found'

Post by EXG133 »

Disclaimer: this is OTRS 3.1 , the final modification of the system before it is permanently archived.

Goal: we want to check when a ticket in a specific queue and with a specific subject is closed and then email a group mailbox.

Problems:

1) the ticket is closed via a webservice call without an ArticleAdd, only a TicketStateUpdate. This can't be changed.
2) OTRS 3.1 doesn't allow Generic Agent to send emails
3)the Event Based Notification can only filter on article subject if there's an article create

What I tried:

I scheduled a Generic Agent to execute a Custom Module when the correct filters are matched.

Here is the pm:

Code: Select all

#!/usr/bin/perl -w

package  Kernel::System::GenericAgent::TEST;

use strict;
use warnings;

use lib "/opt/otrs";
use lib "/opt/otrs/Kernel/cpan-lib";
use lib "/opt/otrs/Custom";

use Kernel::System::Email;
my $ticketnumber = $ARGV[0];
my $ticketid = $ARGV[1];


sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {};
    bless( $Self, $Type );

    # 0=off; 1=on;
    $Self->{Debug} = $Param{Debug} || 0;

    return $Self;
}

sub Run {
        my ( $Self, %Param ) = @_;
        my $MailTo = 'me@stuff.fake';
        my $Message = 'CLOSED';

    $Self->{SendmailObject}->Send(
        From => 'OTRS1' . ' <'
              . 'otrs1@fake.fake' . '>',
        To => $MailTo,
        Subject => '[Ticket#'.$ticketnumber.']CLOSED',
        MimeType => 'text/plain',
        Charset => 'utf-8',
        Body => $Message,
        Loop => 1,
    );
}
Then I added this in Execute custom module:

Kernel::System::GenericAgent::TEST

When the GenericAgent runs I get this:

Oct 9 10:40:02 servername OTRS-otrs.GenericAgent.pl-99[29915]: [Notice][Kernel::System::GenericAgent::_JobRunTicket] Use module (Kernel::System::GenericAgent::TEST) for Ticket (99929557/1003438).
Oct 9 10:40:02 servername OTRS-otrs.GenericAgent.pl-99[29915]: [Error][Kernel::System::GenericAgent::_JobRunTicket][Line:1148]: Module Kernel/System/GenericAgent/TEST.pm not found!

What am I missing? Or is there a better way that doesn't include upgrading?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Generic Agent Execute custom module results in 'Module not found'

Post by crythias »

EXG133 wrote:we want to check when a ticket in a specific queue and with a specific subject is closed
Only articles create subjects, so it's not an article update. But you can search on "title" and "State Update" Notification Event.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Locked