[SOLVED] (in a different way) GenAgent Custom Module

Moderator: crythias

Locked
thr
Znuny newbie
Posts: 24
Joined: 10 Apr 2014, 13:18
Znuny Version: 3.3.4

[SOLVED] (in a different way) GenAgent Custom Module

Post by thr »

Hello everybody,

i am currently trying to develop a custom module for the Generic Agent, but i could use some help with that. I am trying to accomplish: When a ticket is created by a customer it is saved in the queue "Dispatch". Then the GenAgent should move this ticket into the next queue and assign an owner. This owner would be determined by the value of a dynamic field, visible in the ticket. And i need a seperate module for this, because i have about 130 possible new owners for the tickets.

Question no.1: As i am completly new to Perl, is this code gonna do the job? If not, whats my mistake?

Code: Select all

package Kernel::System::GenericAgent::DispatchCustomerTickets;
use strict;
use warnings;

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

    my $Self = {};
    bless( $Self, $Type );

    for (qw(DBObject ConfigObject MainObject EncodeObject TicketObject)) {
        $Self->{$_} = $Param{$_} || die "Got no $_!";
    }
    return $Self;
}

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

    %ticket = $Self->{TicketObject}->TicketGet(
        %Param,
        DynamicFields => 1,
    );
    
    $dynField = %ticket->DynamicField_Description;

    if ($dynField eq '0004') {
        $newOwner = 'kleinst';
    } elsif ($dynField eq '0005') {
        $newOwner = 'aunw';
    ..... some more
     } else {
        $newOwner = 'schneider';
    }

    $Self->{TicketObject}->TicketQueueSet(
        TicketID   => $Param{TicketID},
        Queue    => 'Support',
    );

    $Self->{TicketObject}->TicketQueueSet(
        TicketID   => $Param{TicketID},
        NewUser    => $newOwner,
    ); 
    return 1;
}
1;

Question no.2: How do i proceed, once the module is ready? I have read, that i have to add an entry for it in the Kernel/Config/GenericAgent.pm Is that everything?

Thanks for any help i can get.
Last edited by thr on 17 Apr 2014, 13:42, edited 2 times in total.
Version: OTRS version 3.3.4 mit ITSM und KIX4OTRS
OS: Debian6 x64
Datenbank: MySQL
Webserver: Apache2
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: GenAgent Custom Module

Post by crythias »

auto-assign owner?

How about:

The queue is the owner.
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
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: GenAgent Custom Module

Post by crythias »

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
thr
Znuny newbie
Posts: 24
Joined: 10 Apr 2014, 13:18
Znuny Version: 3.3.4

Re: GenAgent Custom Module

Post by thr »

Thought about that, but there is a "political" problem. In the long term this tickets will need to be "Approved" by department-heads. If i keep all of the tickets in the queue, every one of this about 130 people would have to check the queue every few days, and look for the tickets he has to "approve".

Despite the fact, that this is too much work (so i have been told...), all of them would have to get RO-right on this queue. And by that, everybody would be able to see ALL tickets. Thats supposed to be prohibited. There's where my idea with the ownership came into place. By assigning the tickets directly, everybody could have RO on the queue, but would only see his own tickets.

I thought that was a very clean idea.
But if you have a better one, please enlighten me, i am into OTRS just about 3 weeks and by far don't know everything. Anyway, thanks for helping out here.
Version: OTRS version 3.3.4 mit ITSM und KIX4OTRS
OS: Debian6 x64
Datenbank: MySQL
Webserver: Apache2
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: GenAgent Custom Module

Post by crythias »

There's a lot of information to process here.

130 agents = 130 queues and 130 groups. viewtopic.php?f=60&t=16933
And then any web-submitter can choose from 130 queues. Not optimal, but ... eh.
Unless a web submitter is part of a CustomerGroup / CustomerGroupSupport enabled and the web submitter can only choose from the queues that are members of the groups the customer is also a member of.

Approval is a big other difference and not easily handled within OTRS unless through processes and Change Management.

>all of them would have to get RO-right on this queue

no. Only dispatch needs to see the dispatch queue.

If tickets are web submitted, don't use Generic Agent to do the job. Make everything you need to happen complete (use ACL) by the time the Customer hits submit.

The point of every agent has his own queue is that the agent can only see tickets for the queue(s) they have rights to (by group membership).
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
thr
Znuny newbie
Posts: 24
Joined: 10 Apr 2014, 13:18
Znuny Version: 3.3.4

Re: GenAgent Custom Module

Post by thr »

Nono, wait, dont get me wrong. I am planning only 2 Queues for the customers for this process.

My idea was this:
- When a customer sends out a ticket with this type (RfC:Approval), then this tickets can only go into the queue "Dispatcher" (limitted via ACL)
- The 130 department-heads, all have RO-permissions on the "Approval"-Queue. And they all have the same Role "Department-head". Only RO, so they dont have to see ALL the tickets
- The module is suposed to forward the tickets from "Dispatcher" in the "Approval"-Queue and assign them directly to their respective owners. And by directly assigning the tickets, i can keep this with only 2 queue, and everybody would only see his own tickets, that he can approve.
Or do i have a problem in my logic? Does this not work that way?

In fact your right, through the process the change Management will come into play later.
Version: OTRS version 3.3.4 mit ITSM und KIX4OTRS
OS: Debian6 x64
Datenbank: MySQL
Webserver: Apache2
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: GenAgent Custom Module

Post by crythias »

thr wrote:When a customer sends out a ticket with this type (RfC:Approval), then this tickets can only go into the queue "Dispatcher" (limitted via ACL)
k. but ...
thr wrote:The module is suposed to forward the tickets from "Dispatcher" in the "Approval"-Queue and assign the directly to their respective owners.
so ... who does that? The module. How does it know?
... something the customer chooses ...
thr wrote:This owner would be determined by the value of a dynamic field, visible in the ticket.
So, what's the purpose of dispatch if the ticket just goes to approval anyway? Why not drop into approval?

and how do you automatically assign a single owner of 130 to a ticket that a customer doesn't also have 130 choices?
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
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: GenAgent Custom Module

Post by crythias »

The reason I was pushing back on this is to not have you do something "harder" but I suppose what you're doing you know why you're doing it. You also need an xml file and you may not want to do a Generic Agent, but rather an Event
viewtopic.php?f=60&t=10090
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
thr
Znuny newbie
Posts: 24
Joined: 10 Apr 2014, 13:18
Znuny Version: 3.3.4

Re: GenAgent Custom Module

Post by thr »

The problem with the Dispatcher-Queue ist this: Technically this is only for customers, BUT Agents and Department-Heads can also send out this ticket. And in case i am a Department head, i dont need the ticket to go to approval, because i can do this myself. And the next step would be, the tickets go into controlling, where the financialls will be checked.

Meaning:
Customer: -> Dispatcher -> Approval -> Controlling
some Agents: -> Dispatcher -> Approval -> Controlling
some Agent & Department heads -> (directly into) Controlling

and to:
and how do you automatically assign a single owner of 130 to a ticket that a customer doesn't also have 130 choices?
I simply can't! Because here comes a bigger one, the possible values for the dynamic field are round about 600(!). I am just happy, the some department-heads are responsible for about 10 of them. So sooner or later i will run into the problem, that i have to populate a dynamic dropdown-field with 600 values... yey.... :/ ( And no, that one can't be skipped. Thats mandatory and a requierement from my boss that this option must be chosen. I thought about a normal text-field here, but am not sure if that would cause too many problems by customer typos etc. ).

So you see the problem i am having... I am happy with any insight oder good advice i can get.

Edit: Sry, the post with the link came to late, didn't see it, but will check it out tomorrow. Got to get home for today.
Version: OTRS version 3.3.4 mit ITSM und KIX4OTRS
OS: Debian6 x64
Datenbank: MySQL
Webserver: Apache2
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: GenAgent Custom Module

Post by crythias »

The problem is multi-fold.
1) You will not be able to stop owner agent kleinst from seeing owner agent aunw's tickets in the same queue.
2) Auto assigning agents is bunk anyway because either there's one agent per queue and then it doesn't matter or there's multiple agents per queue and if the customer can't assign by queue, the agent can and should be assigned *directly* through the "Owner" interface. And ... no need to do anything special to make that work. There is no need to use a different interface to do the exact same thing. But if you want to LABEL it differently, go right ahead with a custom translation.

yeah. the problem is worse because you're getting the customer to choose the agent he wants to have and you know he could just do that by choosing one of the queue(s) that holds the agent that he'd choose in the dynamic field.

"But What about approval?"

OK. Who gets to choose the agent assigned? The customer or the approval person?
If the customer, that's easy, select a queue. aunw. Use a dynamic field and/or a special note-type that is approval. Use ACL to block (something) until dynamic field approved=Yes.
If the agent, that's easy, use the owner selection and/or the ticket/move. Because that's an immediate do-what-I-mean thing.
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
thr
Znuny newbie
Posts: 24
Joined: 10 Apr 2014, 13:18
Znuny Version: 3.3.4

Re: GenAgent Custom Module

Post by thr »

Allright, so far thanks very much for all the advice.
I will have to take a better look at it tomorrow, and maybe rethink the concept a little bit.
If some follow-up questins arise, i will post them here. Thanks again for helping out.
Version: OTRS version 3.3.4 mit ITSM und KIX4OTRS
OS: Debian6 x64
Datenbank: MySQL
Webserver: Apache2
thr
Znuny newbie
Posts: 24
Joined: 10 Apr 2014, 13:18
Znuny Version: 3.3.4

Re: GenAgent Custom Module

Post by thr »

Allright, i did alter my concept a little bit with your help. But as long as i am on it, i do have one follow-up question regarding a problem i already mentioned:

Is there a (more or less) "easy" way to populate a dynamic Dropdown-Field with 130 values (trying a diffrent approach, instead of the 650)? With a script or something like that?
Of course, i could manually add all the values via the web-interface. But, if there is a more elegant way, i would like to avoid that.

Anyway, again thanks you have been a big help.
Version: OTRS version 3.3.4 mit ITSM und KIX4OTRS
OS: Debian6 x64
Datenbank: MySQL
Webserver: Apache2
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: GenAgent Custom Module

Post by crythias »

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
thr
Znuny newbie
Posts: 24
Joined: 10 Apr 2014, 13:18
Znuny Version: 3.3.4

Re: GenAgent Custom Module

Post by thr »

Allright, thanks. I guess i can figure something out based on this.

I'll try to go ahead on my own for now, if anything arises i'll post again.
Anyway, thanks one last time for helping out here.
Version: OTRS version 3.3.4 mit ITSM und KIX4OTRS
OS: Debian6 x64
Datenbank: MySQL
Webserver: Apache2
Locked