[rt-users] help with scrip (search correspond body)

Robert Vicchiullo rob at hautelook.com
Fri Aug 12 18:48:52 EDT 2011


Ive also tried
my $Attachment = $self->TicketObj->TransactionObj->Attachments;
my $Content = $Attachment->First->Content;
but I get an error on that saying:
ug 12 15:48:01 rt RT: Scrip 6 IsApplicable failed: Can't locate object method "Attachments" via package "No object mapping for field" (perhaps you forgot to load "No object mapping for field"?) at (eval 538) line 1.  Stack:   [(eval 538):1]   [/opt/rt4/sbin/../lib/RT/ScripCondition.pm:207]   [/opt/rt4/sbin/../lib/RT/Scrip.pm:410]   [/opt/rt4/sbin/../lib/RT/Scrips.pm:225]   [/opt/rt4/sbin/../lib/RT/Transaction.pm:179]   [/opt/rt4/sbin/../lib/RT/Record.pm:1447]   [/opt/rt4/sbin/../lib/RT/Ticket.pm:2237]   [/opt/rt4/sbin/../lib/RT/Ticket.pm:2145]   [/opt/rt4/local/plugins/RT-Extension-CommandByMail/lib/RT/Interface/Email/Filter/TakeAction.pm:341]   [/opt/rt4/sbin/../lib/RT/Interface/Email.pm:1612]   [/opt/rt4/sbin/../lib/RT/Interface/Email.pm:1429]   [/opt/rt4/share/html/REST/1.0/NoAuth/mail-gateway:61] (/opt/rt4/sbin/../lib/RT/Condition/UserDefined.pm:65)

From: rt-users-bounces at lists.bestpractical.com [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Robert Vicchiullo
Sent: Friday, August 12, 2011 1:57 PM
To: RT-Users at lists.bestpractical.com
Subject: [rt-users] help with scrip (search correspond body)

Need a little help and would appreciate any advice.
I am trying to write a scrip for
"On Correspond Notify Requestors and Ccs"
I have Condition set to User defined and stage set to transactionbatch.

In Custom condition I have:

my $Content =  $self->TransactionObj->Attachments->First->Content;
$RT::Logger->error($Content);
if( $Content =~ m/Status\:/ ){
  $RT::Logger->error("--->found Status...");
  return 0;
}
$RT::Logger->error("--->NOT FOUND!!!");
return 1;

but for some reason the content is always blank, and even weirder it somehow gets in the if statement and logs "--->found status..."
so first off why is it not finding the content, I want to simply check the body of the email for a string, which I found multiple places on the wiki and list using the above way. Second why is the if statement finding "Status:" in an empty string??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110812/00ffb99a/attachment.htm>


More information about the rt-users mailing list