Stats ticket owned by differents agents

Moderator: crythias

Post Reply
morel
Znuny newbie
Posts: 6
Joined: 30 Sep 2016, 12:32
Znuny Version: OTRS::ITSM 5

Stats ticket owned by differents agents

Post by morel »

Hello,

First of all as it's my first post, thank you for the help provided on this forum!
I found most answers of my questions here but not for the following one.

We can have both internal and contractors working on the same tickets. Internal as level 1 support and then contractors for level 2 or level 3.

My concern is that I want to be able to follow stats on number of tickets owned. This mean for a ticket owned by Agent A (internal) and then by agent B (contractor), in my stats the ticket must count for both and not only the agent that owned the ticket at the time of the stat?

Is this achievable?
patzig
Znuny newbie
Posts: 71
Joined: 08 Mar 2016, 12:45
Znuny Version: 5.0.10
Real Name: Patrick

Re: Stats ticket owned by differents agents

Post by patzig »

Hey,

my idea, work with responsible and owner.

your firstlevel agents are always owner of the ticket and when it gets to 2nd level set the agents to responsible.
Live-System: OTRS 5.0.10, CentOS 7
Testsystem: OTRS 5.0.9, CentOS 6.6
morel
Znuny newbie
Posts: 6
Joined: 30 Sep 2016, 12:32
Znuny Version: OTRS::ITSM 5

Re: Stats ticket owned by differents agents

Post by morel »

Hello this can answer part of my question. Thanks you.

Actually we have two distinct internal team one for functional support and the other one for technical support.

So one ticket can be first analyzed by funtionnal team then sent to contractors for deeper analyzis and finaly to the technical team for action.

How can I have this ticket count for each team that did work on it? I guess this is a usual case?
For the record we defined one queue for each internal team and contractors.
wurzel
Znuny guru
Posts: 3234
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Stats ticket owned by differents agents

Post by wurzel »

Hi,

you can "mark" a ticket with a generic agent and a dynamic field if it is moved to another queue.
in other words: "Generic Agent sets a value in a dynamic field, if the ticket is moved"

This can be done once. If you want to count the movements you have to use a Webservice.

Flo
OTRS 8 SILVER (Prod)
OTRS 8 auf Debian 11 (Test)
Znuny 7.x latest version testing auf Debian 11

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
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: Stats ticket owned by differents agents

Post by reneeb »

wurzel wrote:Hi,

This can be done once. If you want to count the movements you have to use a Webservice.

Flo
No, a simple event module can do the job... (a dynamic field "MoveCounter" is needed)

Code: Select all

# --
# Copyright (C) 2016 Perl-Services.de, http://perl-services.de
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

package Kernel::System::Ticket::Event::CountMoves;

use strict;
use warnings;

use Kernel::System::VariableCheck qw(:all);

our @ObjectDependencies = qw(
    Kernel::Config
    Kernel::System::DynamicField
    Kernel::System::DynamicField::Backend
    Kernel::System::Log
    Kernel::System::Ticket
);

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

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

    return $Self;
}

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

    my $LogObject                     = $Kernel::OM->Get('Kernel::System::Log');
    my $DynamicFieldObject        = $Kernel::OM->Get('Kernel::System::DynamicField');
    my $DynamicFieldBackendObject = $Kernel::OM->Get('Kernel::System::DynamicField::Backend');

    # check needed stuff
    for my $Needed (qw(Data Event Config UserID)) {
        if ( !$Param{$Needed} ) {
            $LogObject->Log(
                Priority => 'error',
                Message  => "Need $Needed!"
            );
            return;
        }
    }

    for my $NeededData (qw(TicketID)) {
        if ( !$Param{Data}->{$NeededData} ) {
            $LogObject->Log(
                Priority => 'error',
                Message  => "Need $NeededData in Data!"
            );
            return;
        }
    }

    return 1 if $Param{Event} ne 'TicketStateUpdate';

    my $DynamicFieldName = 'MoveCounter';

    my %Ticket = $Kernel::OM->Get('Kernel::System::Ticket')->TicketGet(
        TicketID      => $Param{Data}->{TicketID},
        DynamicFields => 1,
    );

    # get dynamic field 
    my $DynamicField = $DynamicFieldObject->DynamicFieldGet( Name => $DynamicFieldName );

    my $CurrentValue = $Ticket{"DynamicField_$DynamicFieldName"};

    # set the value
    my $Success = $DynamicFieldBackendObject->ValueSet(
        DynamicFieldConfig => $DynamicField,
        ObjectID           => $Param{Data}->{TicketID},
        Value              => $CurrentValue + 1,
        UserID             => $Param{UserID},
    );

    if ( !$Success ) {
        $LogObject->Log(
            Priority   => 'error',
            Message => "Can not update $DynamicFieldName"
        );
    }

    return 1;
}

1;
Enable it in Kernel/Config.pm and that's it...
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
morel
Znuny newbie
Posts: 6
Joined: 30 Sep 2016, 12:32
Znuny Version: OTRS::ITSM 5

Re: Stats ticket owned by differents agents

Post by morel »

Thank you for you return. It seems that with your solution I'm able to count the number of time a tickets moved from one queue to another but not the number of tickets owned by a specific user. Let me explain with example:

Ticket 1 : has been owned by agent A then Agent B then Agent C
Ticket 2 : has been owned only by agent B
Ticket 3 : has been owned only by agent B and then agent C

If I do stats I want to see:

Agent A --> 1 ticket (Ticket 1)
Agent B --> 3 tickets (Tickets 1 +2 + 3)
Agent C --> 2 tickets (Tickets 1 + 3)

Any idea?
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: Stats ticket owned by differents agents

Post by reneeb »

For that you have to write your own stats module (or use the SQL box directly). The information is stored in the ticket history.
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
morel
Znuny newbie
Posts: 6
Joined: 30 Sep 2016, 12:32
Znuny Version: OTRS::ITSM 5

Re: Stats ticket owned by differents agents

Post by morel »

OK I'll go for the SQL ;)
Is there a simplified data model with main tables?
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: Stats ticket owned by differents agents

Post by reneeb »

morel wrote:OK I'll go for the SQL ;)
Is there a simplified data model with main tables?
There's only https://raw.githubusercontent.com/OTRS/ ... iagram.png
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
Post Reply