Is ticket's responsible can be set according to a dynamic field?

Moderator: crythias

Post Reply
yangrandong
Znuny newbie
Posts: 5
Joined: 14 Jan 2015, 13:02
Znuny Version: 4.0.3
Real Name: deven
Company: hc

Is ticket's responsible can be set according to a dynamic field?

Post by yangrandong »

I have OTRS 4 installed on RHEL 6. and i need a process which handles change request.

When a user submited a request, the request needs to be approved by his/her direct manager, if approved by direct manager, the ticket will be send to IT manager for approval.
The problem is, there are tens of departments, and in each department there are tens of managers. It is supposed that each manager only approves requests in his own unit. So I create a dynamic field called department, and assigned it to users activity dialog. Then the next step user will choose direct manager though a dropdown field. Then i need set the ticket responsible to the manager which user chosed in the previous step. That means I need to set ticket responsible to a dynamic value not a specify person.

It it possible to finish this process like I described above? I don't want to create each activity for each department/manager.
yangrandong
Znuny newbie
Posts: 5
Joined: 14 Jan 2015, 13:02
Znuny Version: 4.0.3
Real Name: deven
Company: hc

Re: Is ticket's responsible can be set according to a dynamic field?

Post by yangrandong »

any idea is appreciated. anybody have some idea?
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Is ticket's responsible can be set according to a dynamic field?

Post by RStraub »

I solved it with a custom event, because we can't yet upgrade to 4.0.x.

From 4.0.x (which you are using) you should be able to use the value of a dynamic field. So you'd need a field that is "hidden" and stores the value of the first responsible, to later on read that field again.
But what the exact syntax is, I cannot tell you. Did you try "DynamicField_NameOfYourField" ?
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
yangrandong
Znuny newbie
Posts: 5
Joined: 14 Jan 2015, 13:02
Znuny Version: 4.0.3
Real Name: deven
Company: hc

Re: Is ticket's responsible can be set according to a dynamic field?

Post by yangrandong »

Thank you very much for your reply.
Custom event solves my problem. Great!
But I really love the idea of using dynamic field. And I did several tests myself. I created a dynamic filed called "DirectManager", and when I set responsible to "DynamicField_DriectManager", the syslog returned error said "No UserID found for 'DynamicField_DirectManager'!" :(
I can hardly do it without dynamic field, otherwise I have to create hundreds of custom events to get it work.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Is ticket's responsible can be set according to a dynamic field?

Post by RStraub »

Well, I can give you the exmpale that works for us, but again: I'm thought you could read the value of dynamic fields in transition actions from otrs 4.0.0 onwards.


1) Copy "TicketResponsibleSet.pm" from "Kernel/System/ProcessManagement/TransitionAction/" to "Custom/Kernel/System/ProcessManagement/TransitionAction/"

2) Search the file for the part where it declares the Success variable:

Code: Select all

my $Success
3) Imagin a not existing name which you will enter as "dummy" in your transition action, e.g. "DynamicFieldResponsible"

4) Edit this part:

Code: Select all

    if (
        defined $Param{Config}->{Responsible}
        && $Param{Config}->{Responsible} ne $Param{Ticket}->{Responsible}
        )
    {
        $Success = $Self->{TicketObject}->TicketResponsibleSet(
            TicketID => $Param{Ticket}->{TicketID},
            NewUser  => $Param{Config}->{Responsible},
            UserID   => $Param{UserID},
        );
    }
    elsif (
        defined $Param{Config}->{ResponsibleID}
        && $Param{Config}->{ResponsibleID} ne $Param{Ticket}->{ResponsibleID}
        )
    {
        $Success = $Self->{TicketObject}->TicketResponsibleSet(
            TicketID  => $Param{Ticket}->{TicketID},
            NewUserID => $Param{Config}->{ResponsibleID},
            UserID    => $Param{UserID},
        );
    }
To look something like this:

Code: Select all

    if (
        defined $Param{Config}->{Responsible}
        && $Param{Config}->{Responsible} ne $Param{Ticket}->{Responsible && $Param{Config}->{Responsible} ne 'DynamicFieldResponsible'}
        )
    {
        $Success = $Self->{TicketObject}->TicketResponsibleSet(
            TicketID => $Param{Ticket}->{TicketID},
            NewUser  => $Param{Config}->{Responsible},
            UserID   => $Param{UserID},
        );
    }
    elsif (
        defined $Param{Config}->{ResponsibleID}
        && $Param{Config}->{ResponsibleID} ne $Param{Ticket}->{ResponsibleID}
        )
    {
        $Success = $Self->{TicketObject}->TicketResponsibleSet(
            TicketID  => $Param{Ticket}->{TicketID},
            NewUserID => $Param{Config}->{ResponsibleID},
            UserID    => $Param{UserID},
        );
    }
    elsif ($Param{Config}->{Responsible} eq 'DynamicFieldResponsible')
    {
        $Success = $Self->{TicketObject}->TicketResponsibleSet(
            TicketID => $Param{Ticket}->{TicketID},
            NewUser  => $Param{Ticket}->{DynamicField_DirectManager},
            UserID   => $Param{UserID},
        );
    }
    else [... snip ...]
This way you do not need hundreds of events. Just a slightly modified perl file and a transition action (which has to be of type ResponsibleSet).

I hope this helps?

Best regards,
Rolf
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
yangrandong
Znuny newbie
Posts: 5
Joined: 14 Jan 2015, 13:02
Znuny Version: 4.0.3
Real Name: deven
Company: hc

Re: Is ticket's responsible can be set according to a dynamic field?

Post by yangrandong »

Awesome! It's just what I need.
I did the file copy and modification. Then I create a transition action like this:

Transition Action Module: TicketResponsibleSet
Config Parameters:
Key: DynamicFieldResponsible
Value: DynamicField_DirectManager

But the syslog still returns error said "No Responsible or ResponsibleID configured!".

Did I mistake something?
You do not have the required permissions to view the files attached to this post.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Is ticket's responsible can be set according to a dynamic field?

Post by RStraub »

Set key to 'Responsible' and value to 'DynamicFieldResponsible' if you used my example in the modified file.

Why?
These values are passed to the .pm file, which will recognize the string 'DynamicFieldResponsible' and hop into the modified ifelse command block.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
yangrandong
Znuny newbie
Posts: 5
Joined: 14 Jan 2015, 13:02
Znuny Version: 4.0.3
Real Name: deven
Company: hc

Re: Is ticket's responsible can be set according to a dynamic field?

Post by yangrandong »

Yes, It works! I just got confused by the value "DynamicFieldResponsible" and "DynamicField_DirectManager". Now I understand what you did with this custom module. You are a great lifesaver! :) Thanks!
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Is ticket's responsible can be set according to a dynamic field?

Post by RStraub »

Very welcome ;)
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
anigseji
Znuny newbie
Posts: 10
Joined: 23 Sep 2016, 15:07
Znuny Version: otrs5

Re: Is ticket's responsible can be set according to a dynamic field?

Post by anigseji »

and some code that works for OTRS 5
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Is ticket's responsible can be set according to a dynamic field?

Post by RStraub »

Should still work if you recreate the changes on the version 5 syntax.

For example instead of $Self->{TicketObject} you'd now use $Kernel::OM->Get('Kernel::System::Ticket')->
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
anigseji
Znuny newbie
Posts: 10
Joined: 23 Sep 2016, 15:07
Znuny Version: otrs5

Re: Is ticket's responsible can be set according to a dynamic field?

Post by anigseji »

still I get this error :(
You do not have the required permissions to view the files attached to this post.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Is ticket's responsible can be set according to a dynamic field?

Post by RStraub »

Could you show us your line 120 ?
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
anigseji
Znuny newbie
Posts: 10
Joined: 23 Sep 2016, 15:07
Znuny Version: otrs5

Re: Is ticket's responsible can be set according to a dynamic field?

Post by anigseji »

there it is.

In green line 120
You do not have the required permissions to view the files attached to this post.
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: Is ticket's responsible can be set according to a dynamic field?

Post by reneeb »

For the future: Please post text not screenshots. That would make it a lot easier to help...

The line 120 should read:

Code: Select all

        && $Param{Config}->{Responsible} ne $Param{Ticket}->{Responsible} && $Param{Config}->{Responsible} ne 'DynamicFieldResponsible'
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
anigseji
Znuny newbie
Posts: 10
Joined: 23 Sep 2016, 15:07
Znuny Version: otrs5

Re: Is ticket's responsible can be set according to a dynamic field?

Post by anigseji »

Excellent thank you very much for your help dear !!!!
wurzel
Znuny guru
Posts: 3234
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: Is ticket's responsible can be set according to a dynamic field?

Post by wurzel »

Hi,

I use dynamic field from database from OTRS Business Solution and take alle values from a database table. No code changes needed, makes upgrades easy :-)
works like a charm.

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.
anigseji
Znuny newbie
Posts: 10
Joined: 23 Sep 2016, 15:07
Znuny Version: otrs5

Re: Is ticket's responsible can be set according to a dynamic field?

Post by anigseji »

How to create a ticket with DynamicFields
anigseji
Znuny newbie
Posts: 10
Joined: 23 Sep 2016, 15:07
Znuny Version: otrs5

Re: Is ticket's responsible can be set according to a dynamic field?

Post by anigseji »

How to create a ticket with DynamicFields???
tiagostruck
Znuny newbie
Posts: 6
Joined: 27 Sep 2016, 19:08
Znuny Version: 5.0.0
Real Name: Tiago Struck

Re: Is ticket's responsible can be set according to a dynamic field?

Post by tiagostruck »

Hi,

I have problem with Transition Action > TicketCreate

I need pass information of a DynamicField of a process to a new ticket. But i can´t.

Somebody can help-me?

Tnks,
anigseji
Znuny newbie
Posts: 10
Joined: 23 Sep 2016, 15:07
Znuny Version: otrs5

Re: Is ticket's responsible can be set according to a dynamic field?

Post by anigseji »

ElectricDreams
Znuny newbie
Posts: 36
Joined: 07 Sep 2016, 16:15
Znuny Version: 5.0.13
Real Name: Christian Moeller
Company: Prüfinstitut Hansecontrol
Location: Hamburg
Contact:

Re: Is ticket's responsible can be set according to a dynamic field?

Post by ElectricDreams »

RStraub wrote: ...
I hope this helps?
Thank you very, very much for that, Rolf! That works perfect :)
Ein Dosenfisch stürzt sich lachend ins offene Meer
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Is ticket's responsible can be set according to a dynamic field?

Post by RStraub »

You're very welcome :)
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Post Reply