Question on "Limit" for Transactions for RT3.0.12

Hello RT3 gurus,

I have trouble coding a scrip Condition triggering on a very special
case: the condition should be true if the “Resolved” date is set for the
very first time.

Now, the trouble is that this transaction [Set Resolved] is not
recorded. However, what is recorded is the Status change. So I though it
logical to look for a Status change to an inactive Status. As I do not
want the condition to trigger on every Status change, I need to find the
first change to an inactive Status:

sub IsApplicable {
my $self = shift;
if (($self->TransactionObj->Field eq ‘Status’) and
($self->Argument eq $self->TransactionObj->NewValue())) {
# we are here when there is a Status change
# copied from StatusChange.pm
if ($self->QueueObj->IsInactiveStatus($self->Argument)) {
# now, we know it’s resolved, rejected or deleted
my $Transactions = $self->TicketObj->Transactions;
$Transactions->Limit (FIELD => ‘Field’,
VALUE => ‘Status’,
ENTRYAGGREGATOR => ‘AND’,
OPERATOR => ‘=’,
);
# Limiting to (Field = ‘Status’)
foreach($self->QueueObj->InactiveStatusArray) {
$Transactions->Limit (FIELD => ‘NewValue’,
VALUE => $_,
ENTRYAGGREGATOR => ‘OR’,
OPERATOR => ‘=’,
);
# adding … OR (NewValue = ‘…’)
}

             my $Transaction = $Transactions->Next;
             # see if there is more than one transaction of this type
             return(undef) if($Transaction and
                           ($Transaction->Id != 

$self->TransactionObj->Id));
}
return(1);
}
else {
return(undef);
}
}

However, the “Limit” criteria seem not to match up to
"Field = ‘Status’ AND (NewValue = ‘resolved’ OR NewValue = ‘rejected’ OR
NewValue = ‘deleted’). So what am I doing wrong?

Best regards,

Ruediger Riediger

Dr. Ruediger Riediger Sun Microsystems GmbH
NSG - SunCERT Komturstr. 18a
mailto:Ruediger.Riediger@Sun.com D-12099 Berlin
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
PGP 2048RSA/0x2C5020E9 964C E189 0FF0 8882 2BAB 65E2 6912 1FF2

However, the “Limit” criteria seem not to match up to
"Field = ‘Status’ AND (NewValue = ‘resolved’ OR NewValue = ‘rejected’ OR
NewValue = ‘deleted’). So what am I doing wrong?

What does the database say you’re searching for?

Hello Jesse,

Jesse Vincent wrote:

However, the “Limit” criteria seem not to match up to
"Field = ‘Status’ AND (NewValue = ‘resolved’ OR NewValue = ‘rejected’ OR
NewValue = ‘deleted’). So what am I doing wrong?

What does the database say you’re searching for?

looks like I found the issue: it did not have anything to do with the
search case (the code I send works fine). We had a local addition to
RT::Condition::Generic.pm so that $self->QueueObj was defined. Looks
like we screwed this up and “$self->QueueObj->InactiveStatusArray” was
returning an empty array. As we used “$self->QueueObj” only here, we
never noticed before. Oh, for those without “$self->QueueObj” defined,
substitute with “$self->TicketObj->QueueObj”.

Thanks for the pointer to the database logs :wink:

Best regards,

Ruediger Riediger

Dr. Ruediger Riediger Sun Microsystems GmbH
NSG - SunCERT Komturstr. 18a
mailto:Ruediger.Riediger@Sun.com D-12099 Berlin
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
PGP 2048RSA/0x2C5020E9 964C E189 0FF0 8882 2BAB 65E2 6912 1FF2