FW: custom field resets to previous value after scrip runs Inbox

Thank you Glen and Kenn,

I have applied transactionbatch and seems to have worked.
Hopefully it stays that way.

DoroFrom: Kenneth Crocker [mailto:KFCrocker@lbl.gov]
Sent: 06 November 2007 20:51
To: Dorothea Muecke-Herzberg
Cc: rt-users
Subject: Re: [rt-users] custom field resets to previous value after
scrip runs

Dorothea,

   This happened to us alot until we change the stage to

“TransactionBatch”. Now they all work, all CF’s stay modified and all is
well. Hope this helps.

Kenn
LBNL

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


The rt-users Archives

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 sales@bestpractical.com or call us at +1 617 812 0745.

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