
Any chance you can supply the script ?
unfortunately no - it was done for a customer, so I can't give it away.
and a quick and dirty howto.
I wouldn't do it 'quick and dirty', but rather by the book ... 1. Create the DynamicField using the GUI. I built an OPM installer that takes care of it, but you will only need one DynamicField, so you can as well do it by hand. Call it 'ExternalTicketNumber', for instance. 2. Implement the PostMasterFilter module (located in $OTRS_HOME/Kernel/System/PostMaster/Filters). The module must have a new() method and a Run() method. The latter does the real job. There are already some existing filters in that directory, so it's easy to copy one of them any modify it. If I understood you correctly, you can use the 'Subject' field of the mail (which is accessible via the GetConfig object) and parse it for the ticket number, so there is no need in parsing the entire mail. Then you do a TicketSearch for the DynamicField 'ExternalTicketNumber' and value of that external number you found, and if you find one, modify the new mail's subject by prepending the ticket number of the OTRS ticket you found in square brackets (unless you modfied the ticket format in OTRS, which might be the case). The PostMaster will then notice it's a followup and append it as an article to the existing ticket. If you don't find a ticket that has the external ticket number in the 'ExternalTicketNumber' dynamic field, add a new GetConfig property using 'X-OTRS-DynamicField-ExternalTicketNumber' as its name and the number as its property. This will add a new header to the mail, which OTRS uses to set the dynamic field in the process. 3. Tell OTRS to use your module by providing an XML configuration file that sets 'PostMaster::PreFilterModule###100-YourTicketModule' to point at your module (see $OTRS_HOME/Kernel/Config/File/Ticket.xml for an example how to do this). You *must* provide that file to tell OTRS to call your module before PostMaster processes the external mail and creates the ticket for you, otherwise it will just sit there doing nothing. Essentially, that's it. If you need to set the status and priority of the external tickets, there is some more parsing to do, and you'll also have to set the 'X-OTRS-State' and 'X-OTRS-Priority' properties in the process, but that's really not a big deal. I'd add some configuration options as well (for example my tool has a confgurable mapping from external ticket system states to OTRS states and the same for priorities), but that may not be necessary for you.
would be greatly appreciated !
I hope this helps a bit. If you are comfortable with Perl, you should get along. Cheers, Peter.