set responsible of ticket based on incoming mail

Moderator: crythias

Locked
mojorianer
Znuny newbie
Posts: 22
Joined: 30 Nov 2010, 01:03
Znuny Version: 3.1.6
Location: Berlin, Germany

set responsible of ticket based on incoming mail

Post by mojorianer »

Hy,

is it possible to set the responsible of a ticket based on the customers' e-mail. The following code only works for phone tickets not for incoming mails.

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="1.0" init="Changes">
    <ConfigItem Name="Ticket::EventModulePost###EventModulePostTemplate" Required="0" Valid="1">
        <Description Lang="en"></Description>
        <Description Lang="de"></Description>
        <Group>EventModulePostTemplate</Group>
        <SubGroup>EventModule</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Module">Kernel::System::Ticket::Event::SetResponsible</Item>
                <Item Key="Event">(TicketCreate|TicketQueueUpdate|TicketResponsibleUpdate)</Item>
            </Hash>
        </Setting>
    </ConfigItem>
</otrs_config>
SetResponsible.pm

Code: Select all

package Kernel::System::Ticket::Event::SetResponsible;

use strict;
use warnings;

use vars qw($VERSION);
$VERSION = qw($Revision: 1.1 $) [1];

sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {};
    bless( $Self, $Type );

    # get needed objects
    for (
        qw(
        ConfigObject CustomerGroupObject CustomerUserObject DBObject EncodeObject GroupObject
        LinkObject LockObject LogObject LoopProtectionObject MainObject
        PriorityObject QueueObject SendmailObject ServiceObject SLAObject StateObject
        TicketObject TimeObject TypeObject UserObject ValidObject
        )
        )
    {
        $Self->{$_} = $Param{$_} || die "Got no $_!";
    }

    return $Self;
}

sub Run {
    my ( $Self, %Param ) = @_;

    # check needed stuff

      my %Ticket = $Self->{TicketObject}->TicketGet(
           TicketID => $Param{TicketID},
           UserID   => 1,
       );
       return 1 if !%Ticket;
	
if ( $Ticket{CustomerUser} eq 'mail@example.com' ) {
    my $Success = $Self->{TicketObject}->TicketResponsibleSet(
        TicketID => $Param{TicketID},
        NewUser   => 'Some Agent',
        UserID    => 1,
    );

}
    return 1;

}
1;
Thanks
OTRS 3.1.10 on CentOS 6
mojorianer
Znuny newbie
Posts: 22
Joined: 30 Nov 2010, 01:03
Znuny Version: 3.1.6
Location: Berlin, Germany

Re: set responsible of ticket based on incoming mail

Post by mojorianer »

Has anyone found a solution?

Thanks
OTRS 3.1.10 on CentOS 6
Locked