[SOLVED] PostMaster Filter by department
Moderator: crythias
[SOLVED] PostMaster Filter by department
Hello,
i want to filter the incoming emails by the department of the user. The users have this field:
how can i filter by this value?
for example, if the department of the user of the incoming mail is xy, then set the queue to xy.
thanks
i want to filter the incoming emails by the department of the user. The users have this field:
how can i filter by this value?
for example, if the department of the user of the incoming mail is xy, then set the queue to xy.
thanks
You do not have the required permissions to view the files attached to this post.
Last edited by zip on 26 Jun 2015, 11:15, edited 1 time in total.
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
-
- 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 by department
This is not possible with Postmaster filter created via the Web UI. You have to write your own Postmaster filter module.
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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: PostMaster Filter by department
ok, any help or useful links about this?
i have one more question, what does "Organization" search for? It's not possible that i set the department as organization so that the filter would work?
i have one more question, what does "Organization" search for? It's not possible that i set the department as organization so that the filter would work?
You do not have the required permissions to view the files attached to this post.
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
-
- 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 by department
This searches for a email header named 'Organization' (this is not used very often)
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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: PostMaster Filter by department
i'm trying to make a own perl module but i'm stuck at one point. Since you are the perl guru, you may could give me a help about this. I'm trying to say "if the department of the user who is sending a mail is xy, then put the ticket into queue xy". How can i retireve the information of the department of the user?
i'm not sure if this piece of code is correct:
i'm not sure if this piece of code is correct:
Code: Select all
my %User = $CustomerUserObject->CustomerUserDataGet(
UserDepartment => 'xy',
);
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: PostMaster Filter by department
Give each department its own email address.
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
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
-
- 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 by department
You have to search for the customer based on the mail address...
https://gist.github.com/reneeb/930cc513fece99dfeb67
https://gist.github.com/reneeb/930cc513fece99dfeb67
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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: PostMaster Filter by department
would be the easiest way and also suggested by me, but they want to do it with one email address.crythias wrote:Give each department its own email address.
thank you very much for the code.
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
Re: PostMaster Filter by department
in the perl module, its possible to hardcode something like
its not working
tried it with debug=3 but got no errors in log
Code: Select all
$Param{GetParam}->{'X-OTRS-Service'} = 'ServiceCategory1';
its not working
tried it with debug=3 but got no errors in log
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: PostMaster Filter by department
Take a look at my PostMaster Filter in my HowTo where a Param is set.
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
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
Re: PostMaster Filter by department
i have the Post Master Filter
https://gist.github.com/reneeb/930cc513fece99dfeb67
and the xml
but it wont work. Do i miss something?
https://gist.github.com/reneeb/930cc513fece99dfeb67
and the xml
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="1.0" init="Application">
<ConfigItem Name="PostMaster::PreFilterModule###111-SetQueueByCustomerDepartment" Required="0" Valid="0">
<Description Translatable="1">Set queue by customer department.</Description>
<Group>Ticket</Group>
<SubGroup>Core::PostMaster</SubGroup>
<Setting>
<Hash>
<Item Key="Module">Kernel::System::PostMaster::Filter::SetQueueByCustomerDepartment</Item>
</Hash>
</Setting>
</ConfigItem>
</otrs_config>
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
Re: PostMaster Filter by department
It still not works ![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
any help with this?![Smile :)](./images/smilies/icon_smile.gif)
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
any help with this?
![Smile :)](./images/smilies/icon_smile.gif)
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: PostMaster Filter by department
It has been almost an entire year. One might think you'd have a workaround on this by now. Like telling your customers to send to department-support@yourdomain.com
Still, and you should know better, we can't fix "it doesn't work."
Still, and you should know better, we can't fix "it doesn't work."
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
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
Re: PostMaster Filter by department
The request was paused and now resumed. It has to work, its not an option to make a workaround like you suggested
Thx for your help, i will acquire some perl skills to solve this.
![Smile :)](./images/smilies/icon_smile.gif)
Thx for your help, i will acquire some perl skills to solve this.
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: PostMaster Filter by department
"it doesn't work" is unhelpful. Logs, error messages, what actually happens, what you think is happening is useful.
Insert log code where variables change or are initiated.
Insert log code where variables change or are initiated.
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
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
Re: PostMaster Filter by department
no logs, no errors, nothing happens
thats the problem, i'm trying to insert log code but i'm failing:
1) I changed this line in the postmaster filter .pm file: $Self->{Debug} = 5; //or 1 or 3
does nothing, it should (i think) write in the log file which is set in config.pm:
$Self->{'LogModule'} = 'Kernel::System::Log::File';
$Self->{'LogModule::LogFile'} = 'C:/otrsQS/OTRS/var/log/otrs.log';
2) I'm trying to write to a own log file, but it still not works:
![Smile :)](./images/smilies/icon_smile.gif)
1) I changed this line in the postmaster filter .pm file: $Self->{Debug} = 5; //or 1 or 3
does nothing, it should (i think) write in the log file which is set in config.pm:
$Self->{'LogModule'} = 'Kernel::System::Log::File';
$Self->{'LogModule::LogFile'} = 'C:/otrsQS/OTRS/var/log/otrs.log';
2) I'm trying to write to a own log file, but it still not works:
Code: Select all
open(my $fh, '>', 'C:\otrs\OTRS\Kernel\System\PostMaster\Filter\log1.txt');
print $fh "cmon ffs\n";
close $fh;
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
Re: PostMaster Filter by department
he does not find the customer, !%CustomerList = 1
so i guess the problem is in
i think PostMasterSearch expects a mail adress but $Param{GetParam}->{From} is like "Max Mustermann <Max.Mustermann@yourdomain.com>"
Code: Select all
return 1 if ( !%CustomerList || scalar keys %CustomerList > 1 );
Code: Select all
# find customer based on sender mail address
my %CustomerList = $Self->{CustomerObject}->CustomerSearch(
PostMasterSearch => $Param{GetParam}->{From},
UserID => 1,
);
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5
Re: PostMaster Filter by department
got it!
need to get the mail out of the string, with
and then
thx reneeb and crythias for your help!
need to get the mail out of the string, with
Code: Select all
my $String1= "<";
my $String2= ">";
my $From = $Param{GetParam}->{From};
(my $Mail) = $From =~ /$String1(.*?)$String2/;
Code: Select all
# find customer based on sender mail address
my %CustomerList = $Self->{CustomerObject}->CustomerSearch(
PostMasterSearch => $Mail,
UserID => 1,
);
OTRS 5.0.9 - CentOS 7 - MariaDB 5.5