Hi,

I've got some strange behaviour here. I have a scrip that changes the
value of custom field
ReleasePhase to "07_Signoff" and the ticket status to "resovled" when
a different custom field is
set to "completed".
Strangely, after the changes have gone through (and can be traced in
the ticket history),
in the last transaction the custom field "ReleasePhase"  gets changed
back to "05_Implementing":

#       Tue Nov 06 17:16:01 2007        dmueckeherzberg - ReleasePhase
07_SignOff changed to 05_Implementing
#       Tue Nov 06 17:16:01 2007        RT_System - Outgoing email recorded     
         [Show]
#       Tue Nov 06 17:15:59 2007        RT_System - Outgoing email recorded     
         [Show]
#       Tue Nov 06 17:15:59 2007        RT_System - Status changed from 'open'
to 'resolved'
#       Tue Nov 06 17:15:58 2007        RT_System - ReleasePhase
05_Implementing changed to 07_SignOff
#       Tue Nov 06 17:15:58 2007        dmueckeherzberg - RolloutOnFTN 
Completed added


Here is my scrip:

custom condition:
#only act if subject has "RolloutFT." and new custom field value is "Complete"
#
my $CFvalue = 'Completed';
unless ($self->TicketObj->Subject =~ /^RolloutFT.:/i) {return 0;}
unless ($self->TransactionObj->Type eq "CustomField" ) {return 0;}
unless ($self->TransactionObj->NewValue eq $CFvalue ) {return 0;}
return 1;

custom prep code:
return 1;

custom cleanup code:
my $CFName = 'ReleasePhase';
my $EndValue = '07_SignOff';
my $RecTransaction = 1;
### setting custom field $CFName to $EndValue
my $QueueObj = $self->TicketObj->QueueObj;
my $CFObj = RT::CustomField->new( $QueueObj->CurrentUser );
$CFObj->LoadByNameAndQueue( Name => $CFName, Queue => $QueueObj->id );
unless( $CFObj->id ) {
  $CFObj->LoadByNameAndQueue( Name => $CFName, Queue => 0 );
  unless( $CFObj->id ) {
    $RT::Logger->warning("custom field '$CFName' isn't global or
defined for queue '". $QueueObj->Name ."'");
    return undef;
  }
}
{
    my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
                                          Field => $CFObj->id,
                                          Value => $EndValue,
                                          RecordTransaction =>
$RecTransaction );
    unless( $st ) {
      $RT::Logger->warning( "Couldn't set $EndValue as value for CF
$CFName:". $msg );
      return undef;
    }
  }
return 1;

Any ideas what is going on?

Thank you

Doro
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we'll take
up to 20 percent off the price. This sale won't last long, so get in touch 
today. 
    Email us at [EMAIL PROTECTED] or call us at +1 617 812 0745.


Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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

Reply via email to