[rt-users] RT 4.0.2: Custom Condition Fails

Kevin Falcone falcone at bestpractical.com
Fri Oct 14 09:01:48 EDT 2011

On Thu, Oct 13, 2011 at 10:35:40PM -0400, Ryan Frantz wrote:

Are you getting this error on startup or during the execution of the
scrip (during ticket creation).

>    Oct 13 22:20:57 rt2 RT: Scrip IsApplicable 14 died. - Can't locate object method "new" via
>    package "RT::Condition::OnAfterHoursCreate" at /usr/local/rt/sbin/../lib/RT/ScripCondition.pm
>    line 173.  Stack:   [/usr/local/rt/sbin/../lib/RT/ScripCondition.pm:173]
>    [/usr/local/rt/sbin/../lib/RT/Scrip.pm:404]   [/usr/local/rt/sbin/../lib/RT/Scrips.pm:225]
>    [/usr/local/rt/sbin/../lib/RT/Transaction.pm:179]
>    [/usr/local/rt/sbin/../lib/RT/Record.pm:1447]   [/usr/local/rt/sbin/../lib/RT/Ticket.pm:669]
>    [/usr/local/rt/sbin/../lib/RT/Interface/Web.pm:1389]
>    [/usr/local/rt/share/html/Ticket/Display.html:127]
>    [/usr/local/rt/share/html/Ticket/Create.html:444]
>    [/usr/local/rt/sbin/../lib/RT/Interface/Web.pm:538]
>    [/usr/local/rt/sbin/../lib/RT/Interface/Web.pm:285]
>    [/usr/local/rt/share/html/autohandler:53] (/usr/local/rt/sbin/../lib/RT/Scrip.pm:419)
>    The name of the custom condition is OnAfterHoursCreate and it is located under
>    <myRtRoot>/local/lib/RT/Condition/.  What's odd is that when I look at the system condition
>    modules, I don't see a new() method defined so I'm not sure why this error is occuring for
>    me.  For reference, this is the code for the custom condition:

The new() method is defined in RT::Condition

Generally, this error means some typo between:

The filename
The package
>    package RT::Condition::OnAfterHoursCreate;
The exec module
>                 ExecModule           => 'OnAfterHoursCreate',

Since at least 2 of those look fine, I'd double-check the filename and
permissions on the file (and on the directories leading to the file).

Incidentally, if you're going to write a number of these, you may find
it useful to write an initialdata file:

cat > customconditions
@ScripConditions = (
        {Name                 => 'On After Hours Create',
        Description          => 'A ticket is created after hours',
        ExecModule           => 'OnAfterHoursCreate',
        ApplicableTransTypes => 'Create',
./sbin/rt-setup-database --action insert --datafile customconditions
Which is a slightly simpler way to register your custom condition.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20111014/fab9b717/attachment.sig>

More information about the rt-users mailing list