Howdy all! I’m fairly new to RT Administration and PERL, so I’m hoping to run by a fairly easy use-case that I’m having challenges with. Running RT 4.4.3
I’ve been toying around with several articles / posts and haven’t been able to get either solution to work.
Use case - Send a specific template email to Requestor based on content in the Subject or the Body of the email On Create for a specific Queue
I’ve tried to follow-
https://rt-wiki.bestpractical.com/wiki/ReplyBasedUponContent
I’ve created a script under the target queue with the following and enabled it after creating a template. Testing completed with the words “Open Sesame” in the body of the email when creating a ticket (Goal is eventually subject line)
Description: Special Use Case
Condition: User Defined
Action: Notify Requestors
Template: Special Use Case
Custom Condition:
my $Attachment = $self->TicketObj->TransactionObj->Attachments;
my $Content = $Attachment->First->Content;
if( $Content =~ m/Open Sesame/ ){
$Ticket->SetStatus( Status => ‘open’ , Force => 1,);
return 1;
}
Custom Action Preparation Code:
-Have tried leaving blank
-Also have tried
return 1;
Custom Action Commit Code:
Same as above, tried both
When enabling it, I’m just not getting RT to send the email to me as the requestor using the template. No errors when saving the scrip.
Second option I tried to follow -
For this one, similar settings, but I tried to only use the “Custom Condition” seen in the last post by the OP:
my $match = “Backup Report [Successful]”;
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject !~ /$match/i ) {
return 1;
}
else {
return 0;
}
I’m getting an error when saving the scrip -
“Couldn’t compile CustomIsApplicableCode codeblock ‘my $match = “Backup Report [Successful]”; my $t_subject = $self->TicketObj->Subject; if ( $t_subject !~ /$match/i ) { return 1; } else { return 0; }’: Unrecognized character \x{201c}; marked by ← HERE after $match = ← HERE near column 19 at (eval 1363) line 1. Stack: [(eval 1363):1] [/opt/rt4/share/html/Admin/Scrips/Modify.html:139] [/opt/rt4/share/html/Admin/autohandler:49] [/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:697] [/opt/rt4/sbin/…/lib/RT/Interface/Web.pm:376] [/opt/rt4/share/html/autohandler:53]”
Can anyone throw me a bone? I am learning, so I do plan to take a functional solution and continue to build on it.
If I’m using a built in Action (Such as Notify Requestors), do I still need to enter “return 1;” in the Custom Action Preparation Code and Custom Action Commit code?
Also, many topics / pages list a field I’m not seeing called “Stage”, is this because of my RT version?
Thanks in advance!