On 18 August 2013 22:05, Dave Fitches <[email protected]> wrote:
> 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… L **** > > 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… > $due_date needs to be an RT::Date object in order to use set or ISO. Is it? ie: $due_date = new RT::Date( $self->CurrentUser ); $due_date->Set(Format => "ISO", Value => $value); $self->TicketObj->SetDue( $due_date->ISO ); Since your dates are not in ISO format I'd probably recommend using Format => 'unknown' to set the RT::Date figure it out. It takes a few extra cycles but provides flexibility when needed. I use this: my $Due = new RT::Date( $self->CurrentUser ); $Due->Set( Format => 'unknown', Value => 'now + 24 hours'); $ticket->SetDue($Due->ISO); > **** > > Problem #2: Writing a comment to the transaction history**** > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**** > > 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…**** > > CUSTOM ACTION CLEANUP CODE: > > ** > > > $self->TicketObj->Comment(Content =>"Notification sent to original > requestor that their order has been processed."**** > > );**** > > I suspect the issue is in the cleanup code…. But it LOOKS correct! (to me > – but I’m a n00b apparently!) > If I'm understanding you correctly and if memory serves me I *think* you can just add RecordTransaction => 1 to the end of this and it'll do what you want. I know this works for AddCustomFieldValue() but I'm not 100% sure if it works for Comment(). Worth a try though. $self->TicketObj->Comment(Content =>"Notification sent to original requestor that their order has been processed.", RecordTransaction => 1); -- Landon Stewart <[email protected]>
