Looking up a ticket by attachment's messageid


#1

Since the MessageId is stored in a field in the Attachments table, I
assume that someone thought it’d be useful to be able to search on that
field. However, I don’t see any API function that allows us to look up
an attachment by messageid, or a ticket by an associated attachment’s
messageid.

What’s the easiest way to go about introducing such a function? I
presume I’d create a “Tickets_Local.pm” file and create the appropriate
function. Is there an existing function that can perform this query?


#2

Since the MessageId is stored in a field in the Attachments table, I
assume that someone thought it’d be useful to be able to search on that
field. However, I don’t see any API function that allows us to look up
an attachment by messageid, or a ticket by an associated attachment’s
messageid.

my $a = RT::Attachment->new($RT::SystemUser);
$a->LoadByCols(MessageId => ‘123@foo.com’);

print $a->TransactionObj->TicketObj->id;

or something along those lines.


#3

Jesse Vincent wrote:

my $a = RT::Attachment->new($RT::SystemUser);
$a->LoadByCols(MessageId => ‘123@foo.com’);

print $a->TransactionObj->TicketObj->id;

or something along those lines.

Yeah, that’s perfect.

I wanted to be able to track issues with RT3, but not use RT3 as a
gateway between support staff and customers. Instead, I just want it to
get a copy of messages and sort them into tickets as appropriate,
which means that the subject won’t ever have ticket numbers in them.
The attached patch seems to do what I want.

reference.patch (1.04 KB)


#4

“Gordon” == Gordon Messmer yinyang@eburg.com writes:

Gordon> I wanted to be able to track issues with RT3, but not use RT3
Gordon> as a gateway between support staff and customers. Instead, I
Gordon> just want it to get a copy of messages and sort them into
Gordon> tickets as appropriate, which means that the subject won’t
Gordon> ever have ticket numbers in them. The attached patch seems to
Gordon> do what I want.

Thanks, this is great!

You might also want to look at the In-Reply-To header, some old MUA do
not use the References: header for email (this header comes from
Usenet if my memory serves well).

Sam
Samuel Tardieu – sam@rfc1149.nethttp://www.rfc1149.net/


#5

An old patch to do what you want is available from
URL:http://www.usit.uio.no/it/rt/modifications/ under the title “Use
References and In-Reply-to of incoming emails to find ticket ID”

Happy hacking,
Petter Reinholdtsen


#6

Petter Reinholdtsen wrote:

An old patch to do what you want is available from
URL:http://www.usit.uio.no/it/rt/modifications/ under the title “Use
References and In-Reply-to of incoming emails to find ticket ID”

Happy hacking,

I came back to this patch and added the In-Reply-To header. I see that
one part of the patch from UiO appears to have been integrated into
RT3. The reset seems overly complicated, or inconsistent (UiO strips <>
from In-Reply-To, but not from anything else) so I’ll keep using my own.

I was quite happy to find the Email-administration package there. I’ve
added that to my installation.

Thanks, again, to everyone that gave me pointers to get this going.

rt3.messageids.patch (1.29 KB)