[SOLVED]PostMaster filter, match certain string from the body and populate Dynamic field entry

Moderator: crythias

Locked
alek12z
Znuny newbie
Posts: 10
Joined: 16 Feb 2021, 11:46
Znuny Version: 6.0.28
Real Name: Aleksandar

[SOLVED]PostMaster filter, match certain string from the body and populate Dynamic field entry

Post by alek12z »

Hi to All,

I have defined dynamic field, that contains Country names, dropdown list, labeled: "Country"(snip 001)


- When user send email, inside the body of the message certain country is included, with following string, as example: Country:Sweden

-You can see how filter is constructed(snip 002) ( matched value is looked up in the body of the message, and if there is match, it needs to populating dynamic field(X-OTRS-DynamicFieldCountry))

So far i was able to construct the Regex phrase, using https://regex101.com/ , tied several other options, they don't work. I know i'm close but still can't make it work :)

Any help or hint is highly appreciated.

Thank you.

Aleksandar
You do not have the required permissions to view the files attached to this post.
Last edited by alek12z on 04 Apr 2021, 20:32, edited 1 time in total.
zzz
Znuny superhero
Posts: 914
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: PostMaster filter, match certain string from the body and populate Dynamic field entry

Post by zzz »

Hey Aleksandar,

Without checking your Regex: try to replace [*] with [***].

Best regards
Emin
Professional Znuny and OTRS services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
alek12z
Znuny newbie
Posts: 10
Joined: 16 Feb 2021, 11:46
Znuny Version: 6.0.28
Real Name: Aleksandar

Re: PostMaster filter, match certain string from the body and populate Dynamic field entry

Post by alek12z »

Hi Emin,

Thanks for reply,

It's even more close now :), just Dynamic field get's the full generated string (from Microsoft power app) - see snip

I would need to have it fetched up to Country section.

Fell free to see the snip, it's more clear there.

Thanks.
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, match certain string from the body and populate Dynamic field entry

Post by reneeb »

As your key in the Dynamic Field is Cxx and not the name of the country, the filter won't work. You either need a customized/programmed Postmaster filter or you need one postmaster filter per country or you use the country name as the key as well.
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
skullz
Znuny superhero
Posts: 658
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: PostMaster filter, match certain string from the body and populate Dynamic field entry

Post by skullz »

because you regex catching the whole phrase ?

try:
Only work if value didnt have a space..So United States wont work

Code: Select all

((?<=\bCountry:)(\w+))
Update:
this should do it.Also with with country name with space. e.g United States

Code: Select all

((?<=\bCountry:)(\w+[^|]+))
My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This

Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
alek12z
Znuny newbie
Posts: 10
Joined: 16 Feb 2021, 11:46
Znuny Version: 6.0.28
Real Name: Aleksandar

Re: PostMaster filter, match certain string from the body and populate Dynamic field entry

Post by alek12z »

Hi skullz,

Your proposal works very well!

Tested and validated, all fine.

Many many thanks! :)

KR,

Aleksandar
Locked