[rt-users] Search Ticket Transaction History in Query Builder?

Brian Schrock Brian.Schrock at gardencitygroup.com
Wed Jun 13 16:24:07 EDT 2012


Yep, I was just staring at that and thinking how permissive that was. Fixing it now.

Brian J. Schrock
Network Operations
The Garden City Group, Inc.
5151 Blazer Parkway Suite A
Dublin, Ohio 43017
Telephone: 614-289-5457
Email: Brian.Schrock at gcginc.com


-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Thomas Sibley
Sent: Wednesday, June 13, 2012 4:23 PM
To: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] Search Ticket Transaction History in Query Builder?

On 06/13/2012 04:15 PM, Brian Schrock wrote:
> Custom Condition:
> my $txn = $self->TransactionObj;
> my $type = $txn->Type;
>
> unless (
>     ($type eq "Status") ||
>     ($type eq 'Set' && $txn->Field eq 'Status') ||
>     ($txn->OldValue eq "resolved") ||
>     ($txn->OldValue eq "stalled") ||
>     ($txn->NewValue eq "open") ||
>     ($txn->Data eq 'Ticket auto-opened on incoming correspondence')
>   ) {

I think your logic is wrong here.  You're OR-ing all those together instead of a combination of AND and OR with parentheses to group correctly.

>   return 0;
> }
>
> return 1;
>
> Custom action cleanup code:
> my $Ticket = $self->TicketObj;
> my $CFName = 'Last Reopened Date';
> my $CF = RT::CustomField->new( $RT::SystemUser );
> $CF->LoadByNameAndQueue( Name => $CFName, Queue => $Ticket->Queue );
>
> my @date  = localtime(time());
> my $year = $date[5] += 1900 ;
> my $month = $date[4] += 1 ;
> my $day = $date[3] ;
> my $date_stamp = "$year-$month-$day";
>
> $Ticket->AddCustomFieldValue( Field => $CF, Value => $date_stamp);

Avoid the localtime math and just pass:

  Value => $self->TransactionObj->CreatedObj->AsString


________________________________

This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.


More information about the rt-users mailing list