<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="EN-US" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal">I must be missing something obvious…</p><p class="MsoNormal"> </p><p class="MsoNormal">On Create, I have a Scrip that looks at the requestor’s Organization field (presuming, of course, they’ve sent us email before and we’ve set a value for it).  If it matches one of the values in a multi-select custom field we have at the Ticket level called “Client”, then it automatically assigns the “Client” custom field to that ticket.  Here is the relevant part from that Scrip:</p>
<p class="MsoNormal"> </p><p class="MsoNormal"><span style="font-family:"Courier New"">my $T_Obj = $self->TicketObj;</span></p><p class="MsoNormal"><span style="font-family:"Courier New"">$T_Obj->AddCustomFieldValue( Field => "Client", Value => $client->Name );</span></p>
<p class="MsoNormal"> </p><p class="MsoNormal">That works great.  Next, it goes to another Scrip that then performs a Notify AdminCcs using a custom template.  This template sends the AdminCcs a copy of the Transaction->Content, but then appends the just assigned custom field to the email.  Here is the relevant part from that Template:</p>
<p class="MsoNormal"> </p><p class="MsoNormal"><span style="font-family:"Courier New"">{$Transaction->Content()}</span></p><p class="MsoNormal"><span style="font-family:"Courier New""> </span></p><p class="MsoNormal">
<span style="font-family:"Courier New"">{ my $OUTPUT;</span></p><p class="MsoNormal"><span style="font-family:"Courier New"">  my $rTicket = RT::Ticket->new( $RT::SystemUser );</span></p><p class="MsoNormal">
<span style="font-family:"Courier New"">  $rTicket->Load($Ticket->id);</span></p><p class="MsoNormal"><span style="font-family:"Courier New"">  my $values = $rTicket->CustomFieldValues('Client');</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">  $OUTPUT .= ":" . $values . ":<BR>";</span></p><p class="MsoNormal"><span style="font-family:"Courier New"">  while (my $value = $values->Next ) {</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">     $OUTPUT .= "*" . $value->Content . "*<BR>";</span></p><p class="MsoNormal"><span style="font-family:"Courier New"">  }</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">  $OUTPUT;</span></p><p class="MsoNormal"><span style="font-family:"Courier New"">}</span></p><p class="MsoNormal"> </p><p class="MsoNormal">
Now, here’s the problem.  If that custom field was propagated via the Scrip mentioned in the first section, it doesn’t carry that value into the Template even though the Template is executed after it:</p><p class="MsoNormal">
 </p><p class="MsoNormal">Execution Order (reversed):</p><p class="MsoNormal"><span style="font-family:"Courier New"">Wed Mar 30 14:39:21 2011 The RT System itself - Outgoing email recorded [Show] </span></p><p class="MsoNormal">
<span style="font-family:"Courier New"">Wed Mar 30 14:39:20 2011 The RT System itself - Outgoing email recorded [Show] </span></p><p class="MsoNormal"><span style="font-family:"Courier New"">Wed Mar 30 14:39:18 2011 The RT System itself - Client AAAA added</span></p>
<p class="MsoNormal"> </p><p class="MsoNormal">If, however, I use RT to create a new ticket and self-select the Client custom field, it will work.  So, I know I’m pulling the right field out in the Template.</p><p class="MsoNormal">
 </p><p class="MsoNormal">I even tried re-loading the ticket (as you see above) in the hopes that it would re-read the new value from the database.</p><p class="MsoNormal"> </p><p class="MsoNormal">Any idea how I might be able to accomplish this?  As far as I can tell, the Scrip is correctly updating the DB, it executes before the Template gets rendered, and the code is correct in the Template.  Thanks.</p>
<p class="MsoNormal"> </p><p class="MsoNormal">--drew</p><p class="MsoNormal"> </p></div></body></html>