Custom GenericAgent Module: find trigger?

Moderator: crythias

Locked
martinv2
Znuny newbie
Posts: 20
Joined: 30 Jun 2014, 14:49
Znuny Version: 6.4.4
Real Name: Martin Vorländer
Company: PDV-Systeme GmbH
Contact:

Custom GenericAgent Module: find trigger?

Post by martinv2 »

Hi all!

I'm writing a custom GenericAgent module that calls multiple webservices to get/pass data from/to an external system. The module itself does already work nicely. The GenericAgent is configured to be triggered by various ticket and article events.

Is there a way for the custom GenericAgent module to find out which event was triggered? I need this to tailor the data sent to the external system.

TIA,
Martin
Znuny 6.4.4, Ubuntu 20.04.5 LTS with MariaDB 10.3.37
martinv2
Znuny newbie
Posts: 20
Joined: 30 Jun 2014, 14:49
Znuny Version: 6.4.4
Real Name: Martin Vorländer
Company: PDV-Systeme GmbH
Contact:

Re: Custom GenericAgent Module: find trigger?

Post by martinv2 »

Seems like there is no solution for this. My workaround is to pass the event name as a parameter, and configure seperate GenericAgents for every single event.

cu,
Martin
Znuny 6.4.4, Ubuntu 20.04.5 LTS with MariaDB 10.3.37
root
Administrator
Posts: 4233
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Custom GenericAgent Module: find trigger?

Post by root »

Hi,

The event is part of %Param. Here is an example of how the hash looks like. Check the key EventValues

Code: Select all

 $VAR1 = {
           'EscalationTimeSearchType' => '',
           'EscalationUpdateTimeSearchType' => '',
           'EscalationResponseTimeSearchType' => '',
           'ChangeTimeSearchType' => '',
           'CustomerUserLogin' => '',
           'EventValues' => [
                              'TicketLockUpdate'
                            ],
           'MIMEBase_From' => '',
           'TicketNumber' => '*',
           'TimePendingSearchType' => '',
           'MIMEBase_Subject' => '',
           'EscalationSolutionTimeSearchType' => '',
           'Valid' => '1',
           'New' => {
                      'ParamValue2' => '',
                      'ParamValue3' => '',
                      'ParamKey2' => '',
                      'ParamValue6' => '',
                      'SendNoNotification' => '0',
                      'ParamKey6' => '',
                      'Note' => {},
                      'CustomerID' => '',
                      'NoteTimeUnits' => '',
                      'Delete' => '0',
                      'NoteFrom' => '',
                      'PendingTime' => '',
                      'ParamKey1' => '',
                      'CustomerUserLogin' => '',
                      'ParamKey3' => '',
                      'NoteBody' => '',
                      'PendingTimeType' => '60',
                      'Module' => 'Kernel::System::GenericAgent::SystemCommandExecution',
                      'ParamKey4' => '',
                      'ParamValue4' => '',
                      'Title' => '',
                      'ParamValue1' => '',
                      'ParamValue5' => '',
                      'ParamKey5' => '',
                      'NoteSubject' => ''
                    },
           'ScheduleLastRun' => '2024-06-14 10:37:20',
           'Title' => '',
           'TimeSearchType' => '',
           'TicketID' => '1',
           'MIMEBase_Body' => '',
           'MIMEBase_Cc' => '',
           'LastChangeTimeSearchType' => '',
           'LastCloseTimeSearchType' => '',
           'MIMEBase_To' => '',
           'CustomerID' => '',
           'Name' => 'Test',
           'ScheduleLastRunUnixTime' => '1718361440',
           'CloseTimeSearchType' => ''
         };
- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
martinv2
Znuny newbie
Posts: 20
Joined: 30 Jun 2014, 14:49
Znuny Version: 6.4.4
Real Name: Martin Vorländer
Company: PDV-Systeme GmbH
Contact:

Re: Custom GenericAgent Module: find trigger?

Post by martinv2 »

Thanks Roy. I can't believe I overlooked that key in the Data::Dumper output when debugging the module.
Znuny 6.4.4, Ubuntu 20.04.5 LTS with MariaDB 10.3.37
martinv2
Znuny newbie
Posts: 20
Joined: 30 Jun 2014, 14:49
Znuny Version: 6.4.4
Real Name: Martin Vorländer
Company: PDV-Systeme GmbH
Contact:

Re: Custom GenericAgent Module: find trigger?

Post by martinv2 »

Looking into this again (for a different GenericAgent), I see that the EventValues key contains the event types configured for the GenericAgent, not the actual event that triggered the execution of the module.

Code: Select all

$VAR1 = {
    # ...
    'EventValues' => [
      'NotificationEscalation',
      'TicketCustomerUpdate',
      'TicketQueueUpdate'
    ],
    # ...
}
So it really seems like there is no solution for this.
Znuny 6.4.4, Ubuntu 20.04.5 LTS with MariaDB 10.3.37
root
Administrator
Posts: 4233
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Custom GenericAgent Module: find trigger?

Post by root »

Hi,

Let me check with the dev team

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
Locked