Copy ticket from one RT system to another

Looking for easy way to copy a ticket from someone else’s RT system (eg: Billing dept) and put it into my RT system (eg: HR dept.) Two completely independent RT systems (different versions, servers, email addresses, etc.)

Occasionally, someone from HR will send a request to the wrong RT system ( Right now, the RT manager of the Billing dept manually forwards the ticket from his RT system to me. I then manually type in the ticket info into my (HR) RT system. I’d like to avoid that :slight_smile: Thankfully, the email he sends me is fixed format (for the most part) and can be parsed with perl, etc.

I have their RT system’s ticket number, and might be able to directly access their MySQL DB. Is there an easy way to pull “give me tix 999” and then insert it into my system (but with a different ticket number)?

I’ve cobbled together a string of stuff to do this automatically, but am looking for a better/easier way. Currently, the email sent to me is procmail’d and piped to formail -I “”, and then pipes into my perl script. The formail part removes all headers and only passes the body of the forwarded message to my perl script (guessing all the headers created from his forwarded email probably have nothing to do w/the original request.)

My perl script then searches through the body of the message looking for specific string matches to obtain the original Requestor and original Subject. I then pass the body of the message to “formail -a Subject: parsedsubject -a To: myRTqueueaddress”, which adds the original requestor’s Subject heading and sets the To: header to MY RT’s email address. I then further pipe this into sendmail -f"originalrequestor’s email address" It’s messy, but seems to work :slight_smile: This got around the entire creating the requestor problem (see below.) It also kept the other RT manager from becoming the requestor.

I previously had my perl script scan for original requestor and subject, and enter/create the ticket directly into my RT system. This worked great, if the original requestor already existed in my RT system. This was based on the CliBasics wiki entry, and was very easy to use and understand.

But if the requestor did not already exist, I got errors about HasRights and stuff. I tried to first create the user using Create() I found in perldoc rt3/lib/, but couldn’t quite get it to work. I then tried ValidateEmailAddress() and LoadOrCreateByEmail() (both in but couldn’t get that to work either. I was trying to create the requestor, then realized I had to check to see if the requestor existed before attempting to create it, then found the load-or-create which seemed to cover both circumstances.

I’m hoping to stop using the formail-sendmail combination and go back to just the perl script (mostly because it seems cleaner if I can remove all that.) I tried rt create -t ticket via the CLI but realized it might be difficult to pass the body of the message to it.

If anyone has an even easier method, I’d greatly appreciate a tip there too.

Thank you,

Paul Hirose : : Sysadm Motto: rm -fr /MyLife
1034 Academic Surge : Programmer/Analyst : Backup Motto : rm -fr /
One Shields Avenue : Voice (530) 752-7181 : Robot, n.: Univ. Admin
Davis, CA 95616-8770 : Fax (530) 752-4465 :