(SOLVED) Postmaster filter problem with multiple parameters

Moderator: crythias

Post Reply
wheelshot
OTRS wizard
Posts: 188
Joined: 15 Dec 2014, 20:49
OTRS Version?: 4.0.24
Location: QC, Canada

(SOLVED) Postmaster filter problem with multiple parameters

Post by wheelshot » 18 Oct 2016, 15:29

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
OTRS wizard
Posts: 104
Joined: 23 Jun 2016, 17:11
OTRS Version?: 5.0.23

Re: Postmaster filter problem

Post by ncmbu » 19 Oct 2016, 09:46

How's your dynamic field defined?

reneeb
OTRS guru
Posts: 4703
Joined: 13 Mar 2011, 09:54
OTRS Version?: 3.3.x
Company: Perl-Services.de
Contact:

Re: Postmaster filter problem

Post by reneeb » 19 Oct 2016, 09:59

Does the Subject contain the term "# Test"? Is the mail a followup?
Perl / OTRS development: http://perl-services.de
Free OTRS add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de

wheelshot
OTRS wizard
Posts: 188
Joined: 15 Dec 2014, 20:49
OTRS Version?: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot » 19 Oct 2016, 15:21

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
OTRS wizard
Posts: 188
Joined: 15 Dec 2014, 20:49
OTRS Version?: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot » 19 Oct 2016, 15:22

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
OTRS wizard
Posts: 188
Joined: 15 Dec 2014, 20:49
OTRS Version?: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot » 25 Oct 2016, 19:07

Bump! Anyone ? Thanks for your help

wheelshot
OTRS wizard
Posts: 188
Joined: 15 Dec 2014, 20:49
OTRS Version?: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot » 03 Nov 2016, 16:49

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
OTRS guru
Posts: 4703
Joined: 13 Mar 2011, 09:54
OTRS Version?: 3.3.x
Company: Perl-Services.de
Contact:

Re: Postmaster filter problem

Post by reneeb » 03 Nov 2016, 17:40

Perl / OTRS development: http://perl-services.de
Free OTRS add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de

wheelshot
OTRS wizard
Posts: 188
Joined: 15 Dec 2014, 20:49
OTRS Version?: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot » 09 Nov 2016, 22:56

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

Thanks again

reneeb
OTRS guru
Posts: 4703
Joined: 13 Mar 2011, 09:54
OTRS Version?: 3.3.x
Company: Perl-Services.de
Contact:

Re: Postmaster filter problem

Post by reneeb » 10 Nov 2016, 12:48

Perl / OTRS development: http://perl-services.de
Free OTRS add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de

wheelshot
OTRS wizard
Posts: 188
Joined: 15 Dec 2014, 20:49
OTRS Version?: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot » 11 Nov 2016, 18:08

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
OTRS guru
Posts: 4703
Joined: 13 Mar 2011, 09:54
OTRS Version?: 3.3.x
Company: Perl-Services.de
Contact:

Re: Postmaster filter problem

Post by reneeb » 12 Nov 2016, 08:26

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 / OTRS development: http://perl-services.de
Free OTRS add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de

wheelshot
OTRS wizard
Posts: 188
Joined: 15 Dec 2014, 20:49
OTRS Version?: 4.0.24
Location: QC, Canada

Re: Postmaster filter problem

Post by wheelshot » 14 Nov 2016, 16:16

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