<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>I encountered a 
strange problem when setting value for a custom field. If anyone can give me a 
lead that will be appreciated.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>The background of 
this problem is listed below:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=945153002-27042006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=945153002-27042006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>RT version: 
3.4.3</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>CustomField: 
Evaluator</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>    
Type- Enter one value, </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>    
Applied to: Tickets,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>    
Assigned to one queue: Changes</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>
<DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=945153002-27042006></SPAN></FONT></DIV></SPAN></FONT><FONT face=Arial 
size=2><SPAN class=945153002-27042006>Scrip:</SPAN></FONT></DIV></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>    
Description: Update Evaluator and Test Status</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>    
Condition: User Defined</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>    
Action: User Defined</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>    
Template: Global template: Blank</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>    
Stage: TransactionCreate</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=945153002-27042006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>Custom condition: 
<omitted as it's working fine></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>Custom action 
preparation code: return 1;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>Custom action 
cleanup code: <see below></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=945153002-27042006>#---------------------------------------Begin------------------------------------</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>my $CF_Eval = 
'Evaluator';<BR>my $evalor = $self->TransactionObj->Creator;<BR>my $eval1 
= RT::User->new(RT::SystemUser);<BR>$eval1->Load($evalor);<BR>my $DV_Eval 
= $eval1->RealName;<BR>my $QueueObj = $self->TicketObj->QueueObj;<BR>my 
$CFObj2 = RT::CustomField->new( $QueueObj->CurrentUser 
);<BR>$CFObj2->LoadByNameAndQueue( Name => $CF_Eval, Queue => 
$QueueObj->id );<BR>unless( $CFObj2->id ) {<BR>    
$CFObj2->LoadByNameAndQueue( Name => $CF_Eval, Queue => 0 
);<BR>    unless( $CFObj2->id ) 
{<BR>      $RT::Logger->error("custom field 
'$CF_Eval' isn't global or defined for queue '". $QueueObj->Name 
."'");<BR>      return undef;<BR>    
}<BR>  }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>    
my( $st, $msg ) = 
$self->TicketObj->AddCustomFieldValue(<BR>                                          
Field => 
$CFObj2->id,<BR>                                          
Value => 
$DV_Eval,<BR>                                          
RecordTransaction => 1 );<BR>    unless( $st ) 
{<BR>      $RT::Logger->error( "Couldn't set 
$DV_Eval as value for CF $CF_Eval:". $msg );<BR>      
return undef;<BR>    }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=945153002-27042006>$RT::Logger->info("My troublshooting - run scrip Set 
Evaluator");</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006>return 
1;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006><SPAN 
class=945153002-27042006>#---------------------------------------End------------------------------------</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006><SPAN 
class=945153002-27042006></SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006><SPAN 
class=945153002-27042006>Note: this action is to set current transaction user to 
be the Evaluator, fill in his real name instead of RT 
id.</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006><SPAN 
class=945153002-27042006></SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=945153002-27042006><SPAN 
class=945153002-27042006>History record in the 
ticket:</SPAN></SPAN></FONT></DIV>
<DIV><SPAN class=945153002-27042006><SPAN class=945153002-27042006><!--StartFragment --><TD align="left"><B><FONT 
face=Arial size=2>RT_System - Evaluator James 
Wot added </FONT></B></SPAN></SPAN></DIV>
<DIV><SPAN class=945153002-27042006><SPAN 
class=945153002-27042006></TD><TD><FONT face=Arial size=2><B>wotj01 - 
Evaluator James Wot deleted</B></FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=945153002-27042006><SPAN class=945153002-27042006><FONT 
face=Arial size=2><STRONG></STRONG></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=945153002-27042006><SPAN class=945153002-27042006><FONT 
face=Arial size=2>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. </FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=945153002-27042006><SPAN class=945153002-27042006><FONT 
face=Arial size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=945153002-27042006><SPAN class=945153002-27042006><FONT 
face=Arial size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=945153002-27042006><SPAN class=945153002-27042006><FONT 
face=Arial size=2>Regards,</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=945153002-27042006><SPAN class=945153002-27042006><FONT 
face=Arial size=2>David</FONT></SPAN></SPAN></DIV>
<DIV><FONT size=2><SPAN class=945153002-27042006><SPAN 
class=945153002-27042006><FONT size=3><FONT face=Arial 
size=2></FONT></TD></TR></FONT></SPAN></SPAN></FONT></DIV></BODY></HTML>