Can't get generic agent to find tickets

Moderator: crythias

Post Reply
thepurpleblob
Znuny newbie
Posts: 13
Joined: 27 Oct 2010, 21:20
Znuny Version: 2.4.9

Can't get generic agent to find tickets

Post by thepurpleblob »

I want to set up the generic agent to find tickets with a certain title and delete them. I can't get it to work. They all have a title, something like..

[Ticket#2013031810000221] You got follow up! (Update notifications)

...anyway, the point is that they will have 'Update notifications' in the title. If I add 'Update notifications', '*Update notifications*', '%Update notifications%' in the Title field of the Ticket Filter it always comes bak with '0 Tickets affected'. Can I and/or how can I do this please?

I looked for help/documentation on this page and couldn't find any.
CSL
Znuny expert
Posts: 159
Joined: 11 Nov 2011, 19:27
Znuny Version: 3.0.11

Re: Can't get generic agent to find tickets

Post by CSL »

The Title search field will generate a LIKE statement in this format:

LIKE '%searchterm%'

If you put more than one word without any quotes, someword1 someword2, it will generate:

AND (((st.title LIKE '%someword1%' ) AND (st.title LIKE '%someword2%' ) ))

If you put them in SINGLE quotes, 'someword1 someword2',, it will generate:

AND (((st.title LIKE '%\'someword1%' ) AND (st.title LIKE '%someword2\'%' ) ))
Note how it's escaped the single quotes and treated it exactly the same as if you didn't put any.

If you put the words inside DOUBLE quotes like this: "someword1 someword2" It will generate:

AND (((st.title LIKE '%someword1 someword2%' ) ))

So what should work for you is putting "Update notifications" into the field (with double quotes, not single quotes). This is because it will escape any single quotes it finds in the string.

There isn't any documentation on this, I don't think... I had to log everything it sent to the database to work this out and find out why some agent's searches were getting zero results.
Backend: OTRS 3.0.11 RedHat Enterprise Linux 6.2, Apache, MySQL with replication
Frontend: OTRS 3.0.11 RedHat Enterprise Linux 6.2 with SELinux, Apache SSL
Post Reply