[rt-users] Creating RT Reminders via Scrip

Andrew Wagner aawagner at wisc.edu
Wed Aug 31 12:36:01 EDT 2011


Hello,

I am running into an issue with a simple scrip that I want to use to 
generate a reminder for the owner of a ticket when its status changes to 
stalled.  I have the conditions working but the action script returns 
some errors.  Here is the action script that I wrote according to the 
RT::Date and RT::Reminders perldocs.

*my $tix = $self->TicketObj;
my $duedate = RT::Date->new($RT::SystemUser);
my $subject = "Test Subject";
my $owner = $tix->Owner;
my $reminder = RT::Reminders->new($RT::SystemUser);

$duedate->SetToNow();
$duedate->AddDays( 3 );

$reminder->Add( Subject => $subject, Owner => $owner, Due => 
$duedate->ISO );
return 1;*

The error messages in the debug log are:*

[Wed Aug 31 16:21:27 2011] [debug]: Tried to load a bogus ticket id: '' 
(/opt/rt4/sbin/../lib/RT/Ticket.pm:158)
[Wed Aug 31 16:21:27 2011] [debug]: '' not a recognised queue object. 
(/opt/rt4/sbin/../lib/RT/Ticket.pm:273)
[Wed Aug 31 16:21:27 2011] [debug]: RT::Ticket=HASH(0x2b986db2a320) No 
queue given for ticket creation. (/opt/rt4/sbin/../lib/RT/Ticket.pm:278)*

In the Reminders.pm file, these errors are generated from this ticket 
creation object within RT::Reminders->Add:

*my ( $status, $msg ) = $reminder->Create(
         Subject => $args{'Subject'},
         Owner => $args{'Owner'},
         Due => $args{'Due'},
         RefersTo => $self->Ticket,
         Type => 'reminder',
         Queue => $self->TicketObj->Queue,
     );*

Any ideas why this might be throwing null results for $self->Ticket and 
$self->TicketObj?  Do I need to call the RT::Reminders->Ticket and 
RT::Reminders->TicketObj methods earlier in the script?  Should I not be 
creating the RT::Reminders object as system user?

I'd appreciate any feedback!

-- 
Andrew Wagner
Assistant Network Administrator
aawagner at wisc.edu
265-5710
Room 370B
Wisconsin Center for Education Research (WCER)
www.wcer.wisc.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110831/305e9378/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 7410 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110831/305e9378/attachment.bin>


More information about the rt-users mailing list