Fun with OTRS: Generic Agent

We use OTRS in a professional capacity, and over time, the database of tickets has gotten rather unruly.

To reduce this, we'd have to a) corral "junk" tickets better, and b) remove them from the database more permanently.

Both can be achieved with the "Generic Agent" in OTRS. As a test, I was hunting for bounce-back notices that were older than 30 days so they could be moved to a spam queue and safely deleted there.


To delete tickets permanently, the solution was easily found; under "Execute Ticket Commands" in the Generic Agent, "Delete Tickets" can be enabled, which will drop all affected tickets from the database.

For safety's sake, I configured a Generic Agent that only targeted tickets in the spam queue older than 30 days.


Targeting the correct tickets was a little harder, and searching on google yielded no swift results as apparently I was the only person who would dare try to do such a thing.

I could find tickets older than 30 days if they had a specific subject line, producing either ~1700 or ~5200 results for either subject I was targeting, but when I tried to target multiple subject lines, there was somehow 0 results.

When working with PostMaster filters, something like the following is tolerated to target multiple subject lines:

(subjecta)|(alternatesubject)

However, as we're working with emails that have since arrived, PostMaster Filters cannot be used. Generic Agent has to be used, and the above is not effective when used as "Select Tickets" criteria.

I found a post that said the | (or) operator was accepted, but as I discovered, what it did not mention is that the Generic Agent requires it to be used twice:

"subjecta"||"alternatesubject"

This correctly detects tickets with a subject matching either of the quoted texts. It does not, however, catch variations on either of the subjects, e.g. "subjectb"

This is more easily solved; wildcards can be used:

"subject*"||"alternatesubject"

This then correctly detects failure notifications with subjects starting with "subject", e.g. "subjecta" or "subjectb", or exactly matching "alternatesubject".


Obviously these are examples, but documenting it in the hope that it helps anyone who has to wrestle with OTRS in the future.

Comments

Popular posts from this blog

Atom editor: Hide project tab / tree view

Removing the watermark from LIV

Videos not working in Irfanview