(SOLVED) Postmaster filter problem with multiple parameters

Moderator: crythias

Post Reply
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

(SOLVED) Postmaster filter problem with multiple parameters

Post by wheelshot »

Hey all,

Im having a hard time configuring a postmaster filter to fill in some dynamic field value.

Here's a screenshot of my config:
2016-10-18 09_26_02-Filtres Postmasters - Administrateur - OTRS - Maxthon Cloud Browser 4.9.2.1000 -.png
Here's the text regex i used:
.*GREAT.*size="1">([^\r\n\t\f<& ]+)

Here's a test example stuff to test:
Askdg8sb asoidaisd
<a href="http://www.w3schools.com/html/">GREAT blablabla size="1">12345</blablabal>
Apiusdiabusd
Asdiubadibus asipduhsadiuhdas

Tested my regex on http://www.regexplanet.com/advanced/perl/index.html and it all seems good but my dynamic field value aint set :(

Do you guys have any clue on how to make it work?

Thanks for your help!
You do not have the required permissions to view the files attached to this post.
Last edited by wheelshot on 14 Nov 2016, 16:16, edited 1 time in total.
ncmbu
Znuny advanced
Posts: 111
Joined: 23 Jun 2016, 17:11
Znuny Version: 5.0.23

Re: Postmaster filter problem

Post by ncmbu »

How's your dynamic field defined?
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Postmaster filter problem

Post by reneeb »

Does the Subject contain the term "# Test"? Is the mail a followup?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot »

ncmbu wrote:How's your dynamic field defined?
Hi, here's the field definition which you'll find simple enough.
2016-10-19 09_19_49-Dynamic Fields Text Backend GUI - OTRS - Maxthon Cloud Browser 4.9.2.1000 - max4.png
You do not have the required permissions to view the files attached to this post.
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot »

reneeb wrote:Does the Subject contain the term "# Test"? Is the mail a followup?
Hi,

Yes, im working on a dev instance so I send myself the email as test and it has the specified filter. If I do remove the regex and just run the filter to lets say move the ticket in a specific queue its working.

Its not a followup mail. Its a new ticket email with no #ticket.

Thanks for your help
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot »

Bump! Anyone ? Thanks for your help
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot »

Ok got my first bug hehe ! I took literally [...] from the example in the set value for the email header which is bad. Im now using [0] and its working with 1 parameter.

Next bug is that I wanna capture more than one parameter from the body.

I've built a regex using an online tool and I concluded with :
<GREAT[^>].*size=\"1\">([^\r\n\t\f<& ]+)<\/GREAT>.*<PIZZA[^>].*size=\"1\">([^<]+)<\/PIZZA>

Thing is that for this to work, i need the regex to be multiline (/s). Is that possible with OTRS postmaster filters?
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Postmaster filter problem

Post by reneeb »

Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot »

AWESOME! Thanks reneeb :) I see that is for OTRS v5+. Is it available / compatible with OTRS v4.x?

Thanks again
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Postmaster filter problem

Post by reneeb »

Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot »

Ok i got it setup and here's how I've done it but it still getting empty fields:
2016-11-11 11_06_24-Filtres Postmasters - Administrateur - OTRS - Maxthon Cloud Browser 4.9.2.1000 -.png
Text regex: <GREAT[^>].*size="1">(?<s1>[^<]+)<\/GREAT>.*<PIZZA[^>].*size="1">(?<s2>[^<]+)</PIZZA>

Test email:
Subject: #TEST
Body:
Asoduygbas

Asdiuabsduibad


Aiusdbiausdsaiub

<GREAT.*size="1">P-2016-052</GREAT>

Asdasd

Asdadasd

<PIZZA.*size="1">siuabduiab iubsdiuabds iub asdiubs asdiubsadui</PIZZA>

sdadsas

Thanks for your help!
You do not have the required permissions to view the files attached to this post.
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Postmaster filter problem

Post by reneeb »

try to use:

Code: Select all

(?ms:<regex>)
(you have to replace <regex> with your actual regex) the "." does not match newlines... with the s modifier that behaviour is changed.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot »

reneeb wrote:try to use:

Code: Select all

(?ms:<regex>)
(you have to replace <regex> with your actual regex) the "." does not match newlines... with the s modifier that behaviour is changed.
It worked great ! Thanks a lot!
Post Reply