Altering a new ticket's subject

Hey all,

I’ve been playing with RT recently and I’ve been charged with making
small automatic modifications to a ticket’s Subject field upon
reception of an email. I’m trying to do this in the least invasive way
possible, but I can’t figure out how to do this without making
modifications to the actual RT code base.

What I’m doing presently is making use of the “Pre” callback in
mail-gateway to add some tags to the message subject line, then
returning the modification to $ARGS{‘message’}.

eg.

   diff -Nur rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway

rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
— rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway 2009-03-20
14:10:23.000000000 -0400
+++ rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
2009-03-20 14:10:46.000000000 -0400
@@ -52,7 +52,11 @@
$ticket => undef
</%ARGS>
<%init>
-$m->comp(’/Elements/Callback’, _CallbackName => ‘Pre’, %ARGS);
+my %argsTmp = $m->comp(’/Elements/Callback’, _CallbackName =>
‘Pre’, %ARGS);
+if($argsTmp{‘message’})
+{
+ $ARGS{‘message’} = $argsTmp{‘message’};
+}
use RT::Interface::Email (); # It’s an exporter, but we don’t care
$r->content_type(‘text/plain; charset=utf-8’);
$m->error_format(‘text’);

There’s gotta be a better way, but I don’t know the code well enough
myself. Can anybody point me in the right direction here? I’m
presently using version 3.6.1 (I know, I know, I know :)). Any help
would be appreciated.

Thanks,

Dan Thomson

Dan,

I’d recommend an RT::Interface::email::Plugin

You can set the plugins you want in your RT_SiteConfig and the plugins
can massage messages before RT touches them.On Fri, Mar 20, 2009 at 04:38:29PM -0400, Dan Thomson wrote:

Hey all,

I’ve been playing with RT recently and I’ve been charged with making
small automatic modifications to a ticket’s Subject field upon
reception of an email. I’m trying to do this in the least invasive way
possible, but I can’t figure out how to do this without making
modifications to the actual RT code base.

What I’m doing presently is making use of the “Pre” callback in
mail-gateway to add some tags to the message subject line, then
returning the modification to $ARGS{‘message’}.

eg.

   diff -Nur rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway

rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
— rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway 2009-03-20
14:10:23.000000000 -0400
+++ rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
2009-03-20 14:10:46.000000000 -0400
@@ -52,7 +52,11 @@
$ticket => undef
</%ARGS>
<%init>
-$m->comp(‘/Elements/Callback’, _CallbackName => ‘Pre’, %ARGS);
+my %argsTmp = $m->comp(‘/Elements/Callback’, _CallbackName =>
‘Pre’, %ARGS);
+if($argsTmp{‘message’})
+{
+ $ARGS{‘message’} = $argsTmp{‘message’};
+}
use RT::Interface::Email (); # It’s an exporter, but we don’t care
$r->content_type(‘text/plain; charset=utf-8’);
$m->error_format(‘text’);

There’s gotta be a better way, but I don’t know the code well enough
myself. Can anybody point me in the right direction here? I’m
presently using version 3.6.1 (I know, I know, I know :)). Any help
would be appreciated.

Thanks,


Dan Thomson


List info: The rt-devel Archives

Ah! Can’t believe I missed that RawMessageRef argument. This is
exactly what I need.

Thanks!2009/3/23 Jesse Vincent jesse@bestpractical.com:

Dan,

I’d recommend an RT::Interface::email::Plugin

You can set the plugins you want in your RT_SiteConfig and the plugins
can massage messages before RT touches them.

On Fri, Mar 20, 2009 at 04:38:29PM -0400, Dan Thomson wrote:

Hey all,

I’ve been playing with RT recently and I’ve been charged with making
small automatic modifications to a ticket’s Subject field upon
reception of an email. I’m trying to do this in the least invasive way
possible, but I can’t figure out how to do this without making
modifications to the actual RT code base.

What I’m doing presently is making use of the “Pre” callback in
mail-gateway to add some tags to the message subject line, then
returning the modification to $ARGS{‘message’}.

eg.

   diff -Nur rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway

rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
— rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway 2009-03-20
14:10:23.000000000 -0400
+++ rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
2009-03-20 14:10:46.000000000 -0400
@@ -52,7 +52,11 @@
$ticket => undef
</%ARGS>
<%init>
-$m->comp(‘/Elements/Callback’, _CallbackName => ‘Pre’, %ARGS);
+my %argsTmp = $m->comp(‘/Elements/Callback’, _CallbackName =>
‘Pre’, %ARGS);
+if($argsTmp{‘message’})
+{
+ $ARGS{‘message’} = $argsTmp{‘message’};
+}
use RT::Interface::Email (); # It’s an exporter, but we don’t care
$r->content_type(‘text/plain; charset=utf-8’);
$m->error_format(‘text’);

There’s gotta be a better way, but I don’t know the code well enough
myself. Can anybody point me in the right direction here? I’m
presently using version 3.6.1 (I know, I know, I know :)). Any help
would be appreciated.

Thanks,


Dan Thomson


List info: The rt-devel Archives

Dan Thomson

It turns out that doesn’t solve my problem.

Since I’m changing the subject line, I need a modified subject value,
but the subject is parsed out of the message before it ever hits the
plugins.

Basically, I need to modify $Message->head->get(“Subject”) (in
RT::Interface::email::Gateway) but there’s no way to do that from a
mail plugin.2009/3/23 Dan Thomson thomson.dan@gmail.com:

Ah! Can’t believe I missed that RawMessageRef argument. This is
exactly what I need.

Thanks!

2009/3/23 Jesse Vincent jesse@bestpractical.com:

Dan,

I’d recommend an RT::Interface::email::Plugin

You can set the plugins you want in your RT_SiteConfig and the plugins
can massage messages before RT touches them.

On Fri, Mar 20, 2009 at 04:38:29PM -0400, Dan Thomson wrote:

Hey all,

I’ve been playing with RT recently and I’ve been charged with making
small automatic modifications to a ticket’s Subject field upon
reception of an email. I’m trying to do this in the least invasive way
possible, but I can’t figure out how to do this without making
modifications to the actual RT code base.

What I’m doing presently is making use of the “Pre” callback in
mail-gateway to add some tags to the message subject line, then
returning the modification to $ARGS{‘message’}.

eg.

   diff -Nur rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway

rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
— rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway 2009-03-20
14:10:23.000000000 -0400
+++ rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
2009-03-20 14:10:46.000000000 -0400
@@ -52,7 +52,11 @@
$ticket => undef
</%ARGS>
<%init>
-$m->comp(‘/Elements/Callback’, _CallbackName => ‘Pre’, %ARGS);
+my %argsTmp = $m->comp(‘/Elements/Callback’, _CallbackName =>
‘Pre’, %ARGS);
+if($argsTmp{‘message’})
+{
+ $ARGS{‘message’} = $argsTmp{‘message’};
+}
use RT::Interface::Email (); # It’s an exporter, but we don’t care
$r->content_type(‘text/plain; charset=utf-8’);
$m->error_format(‘text’);

There’s gotta be a better way, but I don’t know the code well enough
myself. Can anybody point me in the right direction here? I’m
presently using version 3.6.1 (I know, I know, I know :)). Any help
would be appreciated.

Thanks,


Dan Thomson


List info: The rt-devel Archives


Dan Thomson

Dan Thomson

It turns out that doesn’t solve my problem.

Since I’m changing the subject line, I need a modified subject value,
but the subject is parsed out of the message before it ever hits the
plugins.

What are you actually trying to do?

I’m basically trying to tag ticket subjects (on creation) with pieces
of information related to the ticket requester.

So if a ticket comes in from person X (identified by their email
address), I can tag the subject
line with a few tidbits of information about them.2009/3/23 Jesse Vincent jesse@bestpractical.com:

On Mon 23.Mar’09 at 12:05:46 -0400, Dan Thomson wrote:

It turns out that doesn’t solve my problem.

Since I’m changing the subject line, I need a modified subject value,
but the subject is parsed out of the message before it ever hits the
plugins.

What are you actually trying to do?

Dan Thomson

Sounds like “use a custom field”:

While changing the subject seems a good thing to to at the first glance it’s
not really sustainable. At one point you want to be able to sort by the
information or evaluate the queue. That’s what custom fields are made for.
They are structured, manageable and provide much more logic than any subject
line ever will :slight_smile:

best
AlexOn Mon, Mar 23, 2009 at 5:25 PM, Dan Thomson thomson.dan@gmail.com wrote:

I’m basically trying to tag ticket subjects (on creation) with pieces
of information related to the ticket requester.

So if a ticket comes in from person X (identified by their email
address), I can tag the subject
line with a few tidbits of information about them.

2009/3/23 Jesse Vincent jesse@bestpractical.com:

On Mon 23.Mar’09 at 12:05:46 -0400, Dan Thomson wrote:

It turns out that doesn’t solve my problem.

Since I’m changing the subject line, I need a modified subject value,
but the subject is parsed out of the message before it ever hits the
plugins.

What are you actually trying to do?


Dan Thomson


List info:
The rt-devel Archives

I agree, I did this at a previous company, if you want to set the subject off of a custom field, this is incredibly easy to do with a Scrip.From: rt-devel-bounces@lists.bestpractical.com [mailto:rt-devel-bounces@lists.bestpractical.com] On Behalf Of Alexander Finger
Sent: Monday, March 23, 2009 11:36 AM
To: Dan Thomson; rt-devel@lists.bestpractical.com
Subject: Re: [Rt-devel] Altering a new ticket’s subject

Sounds like “use a custom field”:

While changing the subject seems a good thing to to at the first glance it’s not really sustainable. At one point you want to be able to sort by the information or evaluate the queue. That’s what custom fields are made for. They are structured, manageable and provide much more logic than any subject line ever will :slight_smile:

best
Alex

I’m basically trying to tag ticket subjects (on creation) with pieces
of information related to the ticket requester.

So if a ticket comes in from person X (identified by their email
address), I can tag the subject
line with a few tidbits of information about them.

2009/3/23 Jesse Vincent <jesse@bestpractical.commailto:jesse@bestpractical.com>:

It turns out that doesn’t solve my problem.

Since I’m changing the subject line, I need a modified subject value,
but the subject is parsed out of the message before it ever hits the
plugins.

What are you actually trying to do?

Dan Thomson
List info: The rt-devel Archives

Dear All,
I need to make this design when I fill a new Ticket .
Example:
Hardware Tests:
Memory : …
Video : …
Sound : …
If the customField can do that , if yes , could you tell me how.
If the customeField can’t do that , could you give me some idea

Best wishes,
Shaekir,From: Joel.Schuweiler@schmoozecom.com
To: af@genevainformation.ch; thomson.dan@gmail.com; rt-devel@lists.bestpractical.com
Date: Mon, 23 Mar 2009 11:58:43 -0500
Subject: Re: [Rt-devel] Altering a new ticket’s subject

I agree, I did this at a previous company,
if you want to set the subject off of a custom field, this is incredibly easy
to do with a Scrip.

From:
rt-devel-bounces@lists.bestpractical.com
[mailto:rt-devel-bounces@lists.bestpractical.com] On Behalf Of Alexander Finger

Sent: Monday, March 23, 2009 11:36
AM

To: Dan Thomson; rt-devel@lists.bestpractical.com

Subject: Re: [Rt-devel] Altering a
new ticket’s subject

Sounds like “use a
custom field”:

While changing the subject seems a good thing to to at the first glance it’s
not really sustainable. At one point you want to be able to sort by the
information or evaluate the queue. That’s what custom fields are made for. They
are structured, manageable and provide much more logic than any subject line
ever will :slight_smile:

best

Alex

I’m basically trying to tag ticket subjects (on creation) with pieces

of information related to the ticket requester.

So if a ticket comes in from person X (identified by their email

address), I can tag the subject

line with a few tidbits of information about them.

Dear All,
I need to make this design when I fill a new Ticket .
Example:
Hardware Tests:
Memory : …
Video : …
Sound : …

   I would prefer to use radio buttons (check box's)
  If the customField can do that , if yes , could you tell me how.
  If the customeField can't do that , could you give me some idea

Best wishes,
Shaekir,

Chat with the whole group, and bring everyone together.

As a followup (in case anybody cares) this is the solution I went with
and it worked like a charm.

Thanks!2009/3/23 Joel Schuweiler Joel.Schuweiler@schmoozecom.com:

I agree, I did this at a previous company, if you want to set the subject
off of a custom field, this is incredibly easy to do with a Scrip.


From: rt-devel-bounces@lists.bestpractical.com
[mailto:rt-devel-bounces@lists.bestpractical.com] On Behalf Of Alexander
Finger
Sent: Monday, March 23, 2009 11:36 AM
To: Dan Thomson; rt-devel@lists.bestpractical.com
Subject: Re: [Rt-devel] Altering a new ticket’s subject

Sounds like “use a custom field”:

While changing the subject seems a good thing to to at the first glance it’s
not really sustainable. At one point you want to be able to sort by the
information or evaluate the queue. That’s what custom fields are made for.
They are structured, manageable and provide much more logic than any subject
line ever will :slight_smile:

best
Alex

On Mon, Mar 23, 2009 at 5:25 PM, Dan Thomson thomson.dan@gmail.com wrote:

I’m basically trying to tag ticket subjects (on creation) with pieces
of information related to the ticket requester.

So if a ticket comes in from person X (identified by their email
address), I can tag the subject
line with a few tidbits of information about them.

2009/3/23 Jesse Vincent jesse@bestpractical.com:

On Mon 23.Mar’09 at 12:05:46 -0400, Dan Thomson wrote:

It turns out that doesn’t solve my problem.

Since I’m changing the subject line, I need a modified subject value,
but the subject is parsed out of the message before it ever hits the
plugins.

What are you actually trying to do?

Dan Thomson


List info: The rt-devel Archives

Dan Thomson

Dear All,
I need to make this design when I fill a new Ticket .
Example:
Hardware Tests:
Memory : …
Video : …
Sound : …

   I would prefer to use radio buttons (check box's)
  If the customField can do that , if yes , could you tell me how.
  If the customeField can't do that , could you give me some idea

Best wishes,
Shaekir,
Chat with the whole group, and bring everyone together.