[rt-users] CustomField is deleted automatically after modified by a scrip

David Di David.Di at sssworldwide.com
Thu May 11 03:52:39 EDT 2006


I encountered a strange problem when setting value for a custom field.
If anyone can give me a lead that will be appreciated.
The background of this problem is listed below:
 
 
RT version: 3.4.3
CustomField: Evaluator
    Type- Enter one value, 
    Applied to: Tickets,
    Assigned to one queue: Changes
Scrip:
    Description: Update Evaluator and Test Status
    Condition: User Defined
    Action: User Defined
    Template: Global template: Blank
    Stage: TransactionCreate
 
Custom condition: <omitted as it's working fine>
Custom action preparation code: return 1;
Custom action cleanup code: <see below>
#---------------------------------------Begin---------------------------
---------
my $CF_Eval = 'Evaluator';
my $evalor = $self->TransactionObj->Creator;
my $eval1 = RT::User->new(RT::SystemUser);
$eval1->Load($evalor);
my $DV_Eval = $eval1->RealName;
my $QueueObj = $self->TicketObj->QueueObj;
my $CFObj2 = RT::CustomField->new( $QueueObj->CurrentUser );
$CFObj2->LoadByNameAndQueue( Name => $CF_Eval, Queue => $QueueObj->id );
unless( $CFObj2->id ) {
    $CFObj2->LoadByNameAndQueue( Name => $CF_Eval, Queue => 0 );
    unless( $CFObj2->id ) {
      $RT::Logger->error("custom field '$CF_Eval' isn't global or
defined for queue '". $QueueObj->Name ."'");
      return undef;
    }
  }
 
    my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
                                          Field => $CFObj2->id,
                                          Value => $DV_Eval,
                                          RecordTransaction => 1 );
    unless( $st ) {
      $RT::Logger->error( "Couldn't set $DV_Eval as value for CF
$CF_Eval:". $msg );
      return undef;
    }
 
$RT::Logger->info("My troublshooting - run scrip Set Evaluator");
 
return 1;
#---------------------------------------End-----------------------------
-------
 
Note: this action is to set current transaction user to be the
Evaluator, fill in his real name instead of RT id.
 
History record in the ticket:
RT_System - Evaluator James Wot added 
wotj01 - Evaluator James Wot deleted
 
Note: first line shows that the scrip updated the CF:Evaluator
successfully but then there's another transaction shows that the user
deleted the CF's value. But the user didn't do that. So it must be some
internal mechanism did that. 
 
 
Regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20060511/492ab521/attachment.htm>


More information about the rt-users mailing list