Good afternoon.
I found somewhere that rt can add letters from correspondence to an existing ticket by itself. To make it easier, there is a group of people who correspond with each other, and each replies by replying to all. At some point, someone adds Rt’s email address to the correspondence. The task is to avoid creating a new ticket each time a member of the correspondence replies, but simply adding it to the existing one. I have already written a simple bash script that parses the body of the email for the subject of the ticket number, so that if a person changes the subject, it does not start a new ticket, but simply adds it to the existing one, despite the different subject of the email.
Hey,
My concern with this kind of approach would be accidental merging of tickets. Perhaps putting a banner at the top of the email that’d make a new ticket to say “This looks like a response to ticket X, you may want to merge it.”.
Inspecting From might be reliable enough.
Cheers,
Andrew
Hi, @aeternuspolyphagus, I think it’s a better option comparing the following SMTP headers:
- Message-ID
- References
- In-Reply-To
I usually reply editing the body, so, your approach won’t be valid for me .
This variant looks best in my humble opinion… Can you tell me, how i can do this?
I believe you’ll want to do an overlay of this function where you add your own logic to determine ticket Id.
I think, you are right. But i cant understand how i can make this. I’m powershell-developer, not perl…
I bet some chatgpt stuff can get you close putting in the prompt and code I get something like this:
sub ExtractTicketId {
my $entity = shift;
# 1️⃣ Try to extract the ticket ID from the Subject
my $subject = Encode::decode("UTF-8", $entity->head->get('Subject') || '');
chomp $subject;
my $ticket_id = ParseTicketId($subject, $entity);
return $ticket_id if $ticket_id;
# 2️⃣ If no ID is found in the Subject, check the Message-ID header
my $message_id = $entity->head->get('Message-ID') || '';
if ($message_id =~ /#(\d+)/) {
return $1; # Return the ticket ID if found
}
# 3️⃣ If all else fails, return undef
return undef;
}
Some docs on overlays:
https://docs.bestpractical.com/rt/5.0.7/RT/StyleGuide.html#The-Overlay-mechanism