Postmaster filter - dynamic fields

Moderator: crythias

Locked
adminrd
Znuny newbie
Posts: 39
Joined: 29 Aug 2013, 15:14
Znuny Version: 5.0.9

Postmaster filter - dynamic fields

Post by adminrd »

Hi all,

I tried to configure a postmaster filter that populates a ticket dynamic field as a followUp.

When first mail arrives all is OK the dynamic field is filled.

When second mail arrives for the same ticket, then the first value of my dynamic field is erased and replaced by the new value.

How can I have the first and second values entered in my dynamic field ?

I tried to use article dynamic fields but now my problem is : how to get these values in the CSV search result without having the whole article details and a very long search time ?

Thanks for your help,
Regards
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Postmaster filter - dynamic fields

Post by crythias »

adminrd wrote:When second mail arrives for the same ticket, then the first value of my dynamic field is erased and replaced by the new value.
This makes sense.

DynamicField_foo = ""
DynamicField_foo = "bar"
DynamicField_foo = "lorem"

When the field is updated, it's updated.
adminrd wrote:How can I have the first and second values entered in my dynamic field ?
On followup, set a value in DynamicField_foo_followup
adminrd wrote:how to get these values in the CSV search result without having the whole article details and a very long search time ?
If they're ticket fields, it won't be so bad. If they're article fields ... you get what you ask for. Just add the fields into CSV export of SysConfig.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
adminrd
Znuny newbie
Posts: 39
Joined: 29 Aug 2013, 15:14
Znuny Version: 5.0.9

Re: Postmaster filter - dynamic fields

Post by adminrd »

Hi,

Thanks for the answer,

Do you mean that I have to create a new dynamic field named Dynamic_foo_followup to store the first value in X-OTRS-Dynamic-foo-followup ?
So I have to add a new filter to match the X-OTRS-FollowUp-dynamic_foo ? that's right ?

Sorry, but I'm little confused in the right way to do.

Regards,
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Postmaster filter - dynamic fields

Post by crythias »

Your original question (roughly paraphrased): How do I keep the original value (on create) and the new value (on followup)?
My answer (roughly paraphrased): Store initial value and new value in separate dynamic fields.

X-OTRS-DynamicField_foo = initial value
X-OTRS-FollowUp-DynamicField_foo_followup = followup value
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
adminrd
Znuny newbie
Posts: 39
Joined: 29 Aug 2013, 15:14
Znuny Version: 5.0.9

[SOLVED]Re: Postmaster filter - dynamic fields

Post by adminrd »

Ok it works

thanks a lot!

Regards
laivando
Znuny newbie
Posts: 9
Joined: 14 Dec 2015, 12:15
Znuny Version: 5.0.14
Real Name: Lai Van Do
Company: NetNam
Contact:

Re: Postmaster filter - dynamic fields

Post by laivando »

Hi Crythias, et al

I tried to configure a postmaster filter that populates a ticket dynamic
field as a followUp.

If any email arrives From user1@company.com, i want to update value
cus_user1 in Dynamicfield_Cus.

Like this for From user2, user3,.. userN.

I want to keep old value before update new value.

I configured some filter example below:

1. From user1 then set X-OTRS-DynamicField_Cus = cus_user1
2. From user1 then set X-FollowUp-OTRS-DynamicField_Cus = cus_user1

3. From user2 then set X-OTRS-DynamicField_Cus = cus_user2
4. From user2 then set X-FollowUp-OTRS-DynamicField_Cus = cus_user2

5. From user3 then set X-OTRS-DynamicField_Cus = cus_user3
6. From user3 then set X-FollowUp-OTRS-DynamicField_Cus = cus_user3

Result: The old value is erased and replaced by new value.

I see your solution in this post
viewtopic.php?t=22806, but I don't understand
X-OTRS-DynamicField_foo = initial value
X-OTRS-FollowUp-DynamicField_foo_followup = followup value

Have I create DynamicField_Cus AND DynamicField_Cus_followup? I don't see
X-OTRS-FollowUp-DynamicField_foo_followup in set email header (just only
X-OTRS-FollowUp-DynamicField_foo).

And any duplicate value when my OTRS received many email from
user1@company.com?
Eggllo
Znuny newbie
Posts: 79
Joined: 09 Jun 2016, 14:27
Znuny Version: 5.0.10

Re: Postmaster filter - dynamic fields

Post by Eggllo »

You would have to create a separate dynamic field for the follow up value, i.e. DynamicField_Cus, DynamicField_Cus_Followup or something along those lines. Once you have actually created the field you should be able to set it from the postmaster filter. You would end up with something like this:

1. From user1 then set X-OTRS-DynamicField_Cus = cus_user1
2. From user1 (followup) then set X-OTRS-FollowUp-DynamicField_Cus_Followup = cus_user1

etc.
OTRS v5.0.10 with ITSM extension.
MySQL database
Ubuntu 16.04 LTS
laivando
Znuny newbie
Posts: 9
Joined: 14 Dec 2015, 12:15
Znuny Version: 5.0.14
Real Name: Lai Van Do
Company: NetNam
Contact:

Re: Postmaster filter - dynamic fields

Post by laivando »

Hi Eggllo,

Thanks for your reply.

I will try and give a feedback.
laivando
Znuny newbie
Posts: 9
Joined: 14 Dec 2015, 12:15
Znuny Version: 5.0.14
Real Name: Lai Van Do
Company: NetNam
Contact:

Re: Postmaster filter - dynamic fields

Post by laivando »

I want to store all value (user1, user2,.. userN) into ONE DynamicField_Cus (and remove duplicate value).
Is there any way to do this?
I don't want use many DynamicField so much.
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 - dynamic fields

Post by reneeb »

To achieve that, you need to write your own postmaster filter module... Search the forum, I have provided some samples...
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
laivando
Znuny newbie
Posts: 9
Joined: 14 Dec 2015, 12:15
Znuny Version: 5.0.14
Real Name: Lai Van Do
Company: NetNam
Contact:

Re: Postmaster filter - dynamic fields

Post by laivando »

Hi reneeb,

I'm not a perl master, so can you give me advise (or link that you provided)

Thanks.
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 - dynamic fields

Post by reneeb »

A sample postmaster filter is available at https://gist.github.com/reneeb/7308b1cb390a26c1bfe5

Instead of setting the queue, you have to:

*) check if it is a followup -> (return if it is a new ticket)
*) get the config of the dynamic field (I assume you know the name of the field) -> http://otrs.perl-services.de/docs/otrs/ ... field.html (DynamicFieldGet)
*) get the value of the dynamic field -> http://otrs.perl-services.de/docs/otrs/ ... ckend.html (ValueGet)
*) Concatenate the old value with new string
*) set the value of the dynamic field -> http://otrs.perl-services.de/docs/otrs/ ... ckend.html (ValueSet)
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
laivando
Znuny newbie
Posts: 9
Joined: 14 Dec 2015, 12:15
Znuny Version: 5.0.14
Real Name: Lai Van Do
Company: NetNam
Contact:

Re: Postmaster filter - dynamic fields

Post by laivando »

So Great :D

I will try and give a feedback.

Many thanks
Locked