Raed,<br><br>Thanks for responding. Yse, I do have a "return 1; in the Custom PRep area. Actually, I have tried getting this to work with the code in one or the other Custom Action areas. As an explanation of the context, I have not been able to get CommanByMail to update a Custom Field defined as either "text" or "Wikitext" if the content is over 76 or so characters. Apparantly, bith Gmail and Thunderbird and perhaps others email providers embed a line break character after that many characters and that causes a "line Break" in CBM and I end up with only partial updates. So, being the stubborn person I am, I got a perl guy to write some code I could put into a scrip that would examine the content of an email, look for a define delimiter (like "Description of Issue:") in the content and put everything after that delimiter into the Custom Field. Make sense? It did to me. In fact, it works perfectly when I set the condition to a Type = "Create" and message header = "received". But on a Correspond (meaning an update email as opposed to a create), it just doesn't seem to see the email at all. Nothing. Nada.<br>
Well, anyway, here's the code:<br><br># Setup initial values<br><br>my $trans = $self->TransactionObj;<br>my $ticket = $self->TicketObj;<br>my $cf_obj = RT::CustomField->new($RT::SystemUser);<br>my $cf_name = "Description";<br>
my $cf_value = "Didn't work";<br>my $message = $ticket->Transactions->First->Content;<br>my $passed = 0;<br>my $content;<br>my $line;<br><br># split up lines in content by line break<br><br>my @lines = split("\n", $message);<br>
<br># walk thru @lines and find the description<br><br>foreach $line (@lines)<br>    {<br>     if  ($passed == 1)<br>         {<br>          if  ($content =~ m/^\n$/)<br>              {<br>               $content = $content.$line;<br>
              }<br>          else<br>              {<br>               $content = $content."\n".$line;<br>              }<br>         }<br>     if  ($line =~ m/^Description of Issue:/)<br>         {<br>          $line =~ s/Description of Issue://;<br>
          $content = $content."\n".$line;<br>          $passed = 1;<br>         }<br>    }<br><br>$cf_value = $content;<br><br># set the value for CF Description<br><br>$cf_obj->LoadByName( Name => $cf_name );<br>
$RT::Logger->debug( "Loaded \$cf_obj->Name = ". $cf_obj->Name() ."\n" );<br>$ticket->AddCustomFieldValue( Field=>$cf_obj, Value=>$cf_value, RecordTransaction=>0 );<br><br>return 1;<br>
<br>Thanks for your help.<br><br>Kenn<br>LBNL<br><br><div class="gmail_quote">On Mon, Oct 11, 2010 at 2:36 AM, Raed El-Hames <span dir="ltr"><<a href="mailto:Raed.El-Hames@vialtus.com">Raed.El-Hames@vialtus.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">








<div link="blue" vlink="purple" lang="EN-GB">

<div>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Ken:</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Can
you post the code that you cut and pasted to get a better idea of the problem.</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Also
something that I always fall into , is writing my action code in “</span><span><span style="font-size: 7.5pt; color: black;">Custom action cleanup code:”  </span></span><span style="color: rgb(31, 73, 125);">and forgetting about
and leaving</span></p>

<p class="MsoNormal"><span><span style="font-size: 7.5pt; color: black;">“Custom action preparation
code:”  </span></span><span style="color: rgb(31, 73, 125);">completely empty, you will need </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">return
true ; </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">there.</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Roy</span></p>

<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> </span></p>

<div style="border-width: medium medium medium 1.5pt; border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; padding: 0cm 0cm 0cm 4pt;">

<div>

<div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; padding: 3pt 0cm 0cm;">

<p class="MsoNormal"><b><span style="font-size: 10pt;" lang="EN-US">From:</span></b><span style="font-size: 10pt;" lang="EN-US"> <a href="mailto:rt-users-bounces@lists.bestpractical.com" target="_blank">rt-users-bounces@lists.bestpractical.com</a>
[mailto:<a href="mailto:rt-users-bounces@lists.bestpractical.com" target="_blank">rt-users-bounces@lists.bestpractical.com</a>] <b>On Behalf Of </b>Kenneth
Crocker<br>
<b>Sent:</b> 08 October 2010 17:25<br>
<b>To:</b> <a href="mailto:rt-users@lists.bestpractical.com" target="_blank">rt-users@lists.bestpractical.com</a><br>
<b>Subject:</b> [rt-users] Help with "Correspond" condition</span></p>

</div>

</div><div><div></div><div class="h5">

<p class="MsoNormal"> </p>

<p class="MsoNormal">To List,<br>
<br>
I have some code that strips information out of the content and sticks it into
a Custom Field. IT works great when I trigger it with an condition set for
email create tickets. Every time, it works with no problem.<br>
<br>
However, when I set the condition for "On Correspond" it does
nothing. I want to be able to update that Custom FIeld the same way I create it
initially and I figured "On Correspond" was the right condition.
Apparently not.<br>
<br>
I look ed in the TRANSACTIONS Table and I See the Type as
"Correspond". So why doesn't the same code (I copied and pasted) that
works for a "Create" not work for "On Correspond"?<br>
<br>
My error messages (which don't make sense since I am user 146 and am a SuperUser)
are below:<br>
<br>
[Fri Oct  8 16:07:44 2010] [warning]: Couldn't enable user 146
(/opt/rt3/bin/../lib/RT/User_Overlay.pm:1143)<br>
[Fri Oct  8 16:12:51 2010] [error]: Group::HasMember was called with an
argument that isn't an RT::Principal or id. It's (undefined)
(/opt/rt3/bin/../lib/RT/Group_Overlay.pm:1046)<br>
<br>
<br>
Can anyone help me on this? I just need to get the condition right.<br>
<br>
Thanks.<br>
<br>
Kenn<br>
LBNL</p>

</div></div></div>

</div>

</div>


</blockquote></div><br>