TransactionObj OldValue is not working for me

I have the following in my resolve scrip that I borrowed from the
site. I added the $self->TransactionObj->OldValue ne "autoclose"
portion but it does not seem to be working. Can anyone help? Basically
I don’t want to get this notification if the status old value was set
to autoclose.

Condition: User defined
Action: Notify Ccs and Requestors
Template: Global resolved

Custom condition:

my $result = undef;

if ($self->TransactionObj->Type eq “Status” &&
$self->TransactionObj->OldValue ne “autoclose” &&
$self->TransactionObj->NewValue eq “resolved”)
{
my $trans_list = $self->TicketObj->Transactions;
my $trans;
my $num_resolved = 0;

while ($trans = $trans_list->Next)
{
    $num_resolved++ if ($trans->Ticket == $self->TicketObj->Id) &&
                       ($trans->Type eq "Status") &&
                       ($trans->NewValue eq "resolved");
}
$result = ($num_resolved <= 1);

}

return($result);

Slamp,

I don't think that the "autoclose" value has anything to do with a 

status change. If you are looking for a transaction with “Type” =
“Status”, then the only values that will work would be the actual status
values that are available. I’m thinking you need to re-evaluate the
condition part of that scrip. What is it you want to do?

Kenn
LBNLOn 3/23/2009 12:51 PM, slamp slamp wrote:

I have the following in my resolve scrip that I borrowed from the
site. I added the $self->TransactionObj->OldValue ne “autoclose”
portion but it does not seem to be working. Can anyone help? Basically
I don’t want to get this notification if the status old value was set
to autoclose.

Condition: User defined
Action: Notify Ccs and Requestors
Template: Global resolved

Custom condition:

my $result = undef;

if ($self->TransactionObj->Type eq “Status” &&
$self->TransactionObj->OldValue ne “autoclose” &&
$self->TransactionObj->NewValue eq “resolved”)
{
my $trans_list = $self->TicketObj->Transactions;
my $trans;
my $num_resolved = 0;

while ($trans = $trans_list->Next)
{
    $num_resolved++ if ($trans->Ticket == $self->TicketObj->Id) &&
                       ($trans->Type eq "Status") &&
                       ($trans->NewValue eq "resolved");
}
$result = ($num_resolved <= 1);

}

return($result);


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Actually I have defined autoclose as a Status which coincides with a
cron script that closes tickets with status autoclose. I have a
resolve scrip notification which is defined in my previous e-mail. I
do not want the notification to go out if the previous status was
“autoclose”.On Mon, Mar 23, 2009 at 6:04 PM, Ken Crocker kfcrocker@lbl.gov wrote:

Slamp,

I don’t think that the “autoclose” value has anything to do with a status
change. If you are looking for a transaction with “Type” = “Status”, then
the only values that will work would be the actual status values that are
available. I’m thinking you need to re-evaluate the condition part of that
scrip. What is it you want to do?

Kenn
LBNL

On 3/23/2009 12:51 PM, slamp slamp wrote:

I have the following in my resolve scrip that I borrowed from the
site. I added the $self->TransactionObj->OldValue ne “autoclose”
portion but it does not seem to be working. Can anyone help? Basically
I don’t want to get this notification if the status old value was set
to autoclose.

Condition: User defined
Action: Notify Ccs and Requestors
Template: Global resolved

Custom condition:

my $result = undef;

if ($self->TransactionObj->Type eq “Status” &&
$self->TransactionObj->OldValue ne “autoclose” &&
$self->TransactionObj->NewValue eq “resolved”)
{
my $trans_list = $self->TicketObj->Transactions;
my $trans;
my $num_resolved = 0;

while ($trans = $trans_list->Next)
{
$num_resolved++ if ($trans->Ticket == $self->TicketObj->Id) &&
($trans->Type eq “Status”) &&
($trans->NewValue eq “resolved”);
}
$result = ($num_resolved <= 1);
}

return($result);


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media. Buy a
copy at http://rtbook.bestpractical.com

Apply a liberal dose of $RT::Logger and see what turns up. I’d split your
IF into 2 pieces and then stick a logger in the gap. Something like

my $Trans = $self->TransactionObj; ### because I’m a lazy typist
if ($Trans->Type eq “Status”)
{

logger call to print value of ->OldValue and ->NewValue

$RT::Logger->debug(“(” . $Trans->Id . ") oldvalue is " .
$Trans->OldValueval ?. ", newvalue is " . $Trans->NewValue);
if ($Trans->OldValue ne “autoclose” && $Trans->NewValue eq “resolved”)
{
blah blah
}
}

At 12:51 PM 3/23/2009, slamp slamp wrote:

I have the following in my resolve scrip that I borrowed from the
site. I added the $self->TransactionObj->OldValue ne “autoclose”
portion but it does not seem to be working. Can anyone help? Basically
I don’t want to get this notification if the status old value was set
to autoclose.

Condition: User defined
Action: Notify Ccs and Requestors
Template: Global resolved

Custom condition:

my $result = undef;

if ($self->TransactionObj->Type eq “Status” &&
$self->TransactionObj->OldValue ne “autoclose” &&
$self->TransactionObj->NewValue eq “resolved”)
{
my $trans_list = $self->TicketObj->Transactions;
my $trans;
my $num_resolved = 0;

while ($trans = $trans_list->Next)
{
    $num_resolved++ if ($trans->Ticket == $self->TicketObj->Id) &&
                       ($trans->Type eq "Status") &&
                       ($trans->NewValue eq "resolved");
}
$result = ($num_resolved <= 1);

}

return($result);


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Gene LeDuc, GSEC
Security Analyst
San Diego State University