Re: [rt-users] Help with Correspond condition
Morning Ken: Try this : Change my $message = $ticket-Transactions-First-Content; to my $message = $self-TransactionObj-Content() ; #and remove my $trans line -you don't need it or my $message = $trans-Content() ; #keeping my $trans line Regards; Roy From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker Sent: 11 October 2010 17:44 To: rt-users@lists.bestpractical.com Subject: Re: [rt-users] Help with Correspond condition Raed, 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. Well, anyway, here's the code: # Setup initial values my $trans = $self-TransactionObj; my $ticket = $self-TicketObj; my $cf_obj = RT::CustomField-new($RT::SystemUser); my $cf_name = Description; my $cf_value = Didn't work; my $message = $ticket-Transactions-First-Content; my $passed = 0; my $content; my $line; # split up lines in content by line break my @lines = split(\n, $message); # walk thru @lines and find the description foreach $line (@lines) { if ($passed == 1) { if ($content =~ m/^\n$/) { $content = $content.$line; } else { $content = $content.\n.$line; } } if ($line =~ m/^Description of Issue:/) { $line =~ s/Description of Issue://; $content = $content.\n.$line; $passed = 1; } } $cf_value = $content; # set the value for CF Description $cf_obj-LoadByName( Name = $cf_name ); $RT::Logger-debug( Loaded \$cf_obj-Name = . $cf_obj-Name() .\n ); $ticket-AddCustomFieldValue( Field=$cf_obj, Value=$cf_value, RecordTransaction=0 ); return 1; Thanks for your help. Kenn LBNL On Mon, Oct 11, 2010 at 2:36 AM, Raed El-Hames raed.el-ha...@vialtus.commailto:raed.el-ha...@vialtus.com wrote: Ken: Can you post the code that you cut and pasted to get a better idea of the problem. Also something that I always fall into , is writing my action code in Custom action cleanup code: and forgetting about and leaving Custom action preparation code: completely empty, you will need return true ; there. Roy From: rt-users-boun...@lists.bestpractical.commailto:rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.commailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker Sent: 08 October 2010 17:25 To: rt-users@lists.bestpractical.commailto:rt-users@lists.bestpractical.com Subject: [rt-users] Help with Correspond condition To List, 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. 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. 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? My error messages (which don't make sense since I am user 146 and am a SuperUser) are below: [Fri Oct 8 16:07:44 2010] [warning]: Couldn't enable user 146 (/opt/rt3/bin/../lib/RT/User_Overlay.pm:1143) [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) Can anyone help me on this? I just need to get the condition right. Thanks. Kenn LBNL RT Training in Washington DC, USA on Oct 25 26 2010 Last one this year -- Learn how to get the most out of RT!
Re: [rt-users] Help with Correspond condition
Raed, Yep. That was it. Thank you so much. I owe you a beer! Kenn LBNL On Tue, Oct 12, 2010 at 9:10 AM, Kenneth Crocker kfcroc...@lbl.gov wrote: Raed, GEEZ! I'll bet that's it. I'll give it a try today. Thanks. Kenn LBNL On Tue, Oct 12, 2010 at 2:15 AM, Raed El-Hames raed.el-ha...@vialtus.comwrote: Morning Ken: Try this : Change my $message = $ticket-Transactions-First-Content; to my $message = $self-TransactionObj-Content() ; #and remove my $trans line –you don’t need it or my $message = $trans-Content() ; #keeping my $trans line Regards; Roy *From:* rt-users-boun...@lists.bestpractical.com [mailto: rt-users-boun...@lists.bestpractical.com] *On Behalf Of *Kenneth Crocker *Sent:* 11 October 2010 17:44 *To:* rt-users@lists.bestpractical.com *Subject:* Re: [rt-users] Help with Correspond condition Raed, 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. Well, anyway, here's the code: # Setup initial values my $trans = $self-TransactionObj; my $ticket = $self-TicketObj; my $cf_obj = RT::CustomField-new($RT::SystemUser); my $cf_name = Description; my $cf_value = Didn't work; my $message = $ticket-Transactions-First-Content; my $passed = 0; my $content; my $line; # split up lines in content by line break my @lines = split(\n, $message); # walk thru @lines and find the description foreach $line (@lines) { if ($passed == 1) { if ($content =~ m/^\n$/) { $content = $content.$line; } else { $content = $content.\n.$line; } } if ($line =~ m/^Description of Issue:/) { $line =~ s/Description of Issue://; $content = $content.\n.$line; $passed = 1; } } $cf_value = $content; # set the value for CF Description $cf_obj-LoadByName( Name = $cf_name ); $RT::Logger-debug( Loaded \$cf_obj-Name = . $cf_obj-Name() .\n ); $ticket-AddCustomFieldValue( Field=$cf_obj, Value=$cf_value, RecordTransaction=0 ); return 1; Thanks for your help. Kenn LBNL On Mon, Oct 11, 2010 at 2:36 AM, Raed El-Hames raed.el-ha...@vialtus.com wrote: Ken: Can you post the code that you cut and pasted to get a better idea of the problem. Also something that I always fall into , is writing my action code in “Custom action cleanup code:” and forgetting about and leaving “Custom action preparation code:” completely empty, you will need return true ; there. Roy *From:* rt-users-boun...@lists.bestpractical.com [mailto: rt-users-boun...@lists.bestpractical.com] *On Behalf Of *Kenneth Crocker *Sent:* 08 October 2010 17:25 *To:* rt-users@lists.bestpractical.com *Subject:* [rt-users] Help with Correspond condition To List, 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. 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. 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? My error messages (which don't make sense since I am user 146 and am a SuperUser) are below: [Fri Oct 8 16:07:44 2010] [warning]: Couldn't enable user 146 (/opt/rt3/bin/../lib/RT/User_Overlay.pm:1143) [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) Can anyone help me on this? I just need to get the condition right
Re: [rt-users] Help with Correspond condition
Ken: Can you post the code that you cut and pasted to get a better idea of the problem. Also something that I always fall into , is writing my action code in Custom action cleanup code: and forgetting about and leaving Custom action preparation code: completely empty, you will need return true ; there. Roy From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker Sent: 08 October 2010 17:25 To: rt-users@lists.bestpractical.com Subject: [rt-users] Help with Correspond condition To List, 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. 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. 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? My error messages (which don't make sense since I am user 146 and am a SuperUser) are below: [Fri Oct 8 16:07:44 2010] [warning]: Couldn't enable user 146 (/opt/rt3/bin/../lib/RT/User_Overlay.pm:1143) [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) Can anyone help me on this? I just need to get the condition right. Thanks. Kenn LBNL RT Training in Washington DC, USA on Oct 25 26 2010 Last one this year -- Learn how to get the most out of RT!
Re: [rt-users] Help with Correspond condition
Raed, 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. Well, anyway, here's the code: # Setup initial values my $trans = $self-TransactionObj; my $ticket = $self-TicketObj; my $cf_obj = RT::CustomField-new($RT::SystemUser); my $cf_name = Description; my $cf_value = Didn't work; my $message = $ticket-Transactions-First-Content; my $passed = 0; my $content; my $line; # split up lines in content by line break my @lines = split(\n, $message); # walk thru @lines and find the description foreach $line (@lines) { if ($passed == 1) { if ($content =~ m/^\n$/) { $content = $content.$line; } else { $content = $content.\n.$line; } } if ($line =~ m/^Description of Issue:/) { $line =~ s/Description of Issue://; $content = $content.\n.$line; $passed = 1; } } $cf_value = $content; # set the value for CF Description $cf_obj-LoadByName( Name = $cf_name ); $RT::Logger-debug( Loaded \$cf_obj-Name = . $cf_obj-Name() .\n ); $ticket-AddCustomFieldValue( Field=$cf_obj, Value=$cf_value, RecordTransaction=0 ); return 1; Thanks for your help. Kenn LBNL On Mon, Oct 11, 2010 at 2:36 AM, Raed El-Hames raed.el-ha...@vialtus.comwrote: Ken: Can you post the code that you cut and pasted to get a better idea of the problem. Also something that I always fall into , is writing my action code in “Custom action cleanup code:” and forgetting about and leaving “Custom action preparation code:” completely empty, you will need return true ; there. Roy *From:* rt-users-boun...@lists.bestpractical.com [mailto: rt-users-boun...@lists.bestpractical.com] *On Behalf Of *Kenneth Crocker *Sent:* 08 October 2010 17:25 *To:* rt-users@lists.bestpractical.com *Subject:* [rt-users] Help with Correspond condition To List, 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. 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. 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? My error messages (which don't make sense since I am user 146 and am a SuperUser) are below: [Fri Oct 8 16:07:44 2010] [warning]: Couldn't enable user 146 (/opt/rt3/bin/../lib/RT/User_Overlay.pm:1143) [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) Can anyone help me on this? I just need to get the condition right. Thanks. Kenn LBNL RT Training in Washington DC, USA on Oct 25 26 2010 Last one this year -- Learn how to get the most out of RT!
[rt-users] Help with Correspond condition
To List, 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. 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. 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? My error messages (which don't make sense since I am user 146 and am a SuperUser) are below: [Fri Oct 8 16:07:44 2010] [warning]: Couldn't enable user 146 (/opt/rt3/bin/../lib/RT/User_Overlay.pm:1143) [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) Can anyone help me on this? I just need to get the condition right. Thanks. Kenn LBNL RT Training in Washington DC, USA on Oct 25 26 2010 Last one this year -- Learn how to get the most out of RT!