[rt-users] Setting Due Dates from E-mail and writing Comments to transaction history from Custom Scrips

Dave Fitches david.fitches at unimelb.edu.au
Mon Aug 19 01:05:03 EDT 2013

Hi all,

Two problems I've been bashing my head against a wall with - any and all assistance appreciated!

Problem 1:  Setting the Due Date based on input from an E-mail
We're using web-forms to generate e-mails into RT which presents the information in an organised and standard manner.

An example is below:

Door Times Request Form :


Campus: Parkville
Door Name: 203

Open Date: 21/08/2013
Open Time: 18:00

Close Date: 21/08/2013
Close Time: 19:00

Building Supervisor: Testy McTest Alot
Department/Faculty Representitive: Campus Operations Group

Requested By: Dave Fitches
Email: dfitches at unimelb.edu.au

Comments: Test job to get due date set for start date as defined by web form.


I want to grab the "Open Date: " date and set it to the ticket's DUE date (Id actually prefer to have to due the day BEFORE that, but lets work on one thing at a time shall we!)

I'm using ExtractCustomFieldValues running to pluck information from these e-mails.

My template goes something like this:

# Set the jobs Due Date from E-mail Body
|Body|(?<=Open Date:    ).*|my $due_date = $value; $due_date->Set(Format => "ISO", Value => $value); $self->TicketObj->SetDue( $due_date->ISO );|q|

This does NOT work for me... :(
Instead I get: " [Mon Aug 19 04:47:17 2013] [error]: Can't call method "Set" on an undefined value at (eval 1293) line 1. " in my logs...

Problem #2: Writing a comment to the transaction history

I've got automatic e-mails being sent to requestors on status changes (we go from New->Open->Ordered->Dispatched->Resolved)
The e-mail goes out ok, but I'd like it to log a comment to the transaction history that says so.
While it shows up in my main HISTORY display, my DISPLAY history is masked to only show comments and correspondence, so I'd like a single comment line there to make seeing whats happened easier...

I've got a custom scrip which goes like this:
                DESCRIPTION:    On Ordered Notify Requestors
CONDITION:       User Defined
ACTION:               Notify Requestors and CC's
TEMPLATE:         Auto-Report - Ordered
STAGE:                 TransactionCreate

                CUSTOM CONDITIONS:
                                my $txn = $self->TransactionObj;
my $type = $txn->Type;
return 0 unless $type eq "Status"
    || ( $type eq 'Set' && $txn->Field eq 'Status');

return 0 unless $txn->NewValue eq "ordered";
return 1;

                                CUSTOM ACTION PREPARATION CODE:

                                CUSTOM ACTION CLEANUP CODE:
                                                $self->TicketObj->Comment(Content =>"Notification sent to original requestor that their order has been processed."

return 1;

I suspect the issue is in the cleanup code.... But it LOOKS correct! (to me - but I'm a n00b apparently!)

Sorry for such a long e-mail. Again, any assistance would be greatly appreciated!

Dave Fitches
This email and any attachments may contain personal information or information that is otherwise confidential or the subject of copyright. Any use, disclosure or copying of any part of it is prohibited. The University does not warrant that this email or any attachments are free from viruses or defects. Please check any attachments for viruses and defects before opening them. If this email is received in error please delete it and notify us by return email. And I'm only using this signature template because I'm told I must conform. Personally I liked my old one better - but that's life! ;)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130819/b0acc0b2/attachment.htm>

More information about the rt-users mailing list