Trigger event 'NotificationOwnerUpdate' from generic agent custom module

English! place to talk about development, programming and coding
Post Reply
ernstf
Znuny newbie
Posts: 3
Joined: 18 Mar 2019, 15:30
Znuny Version: 6.0.16
Real Name: Ernst Fichtner
Company: d-con.net
Location: Austria

Trigger event 'NotificationOwnerUpdate' from generic agent custom module

Post by ernstf »

Hi,

my task ist to assign a ticket to a specific agent upon ticket creation based on an identification in the ticket title.
Since i'd need 30 GA-Jobs to assign "O01*" to agent1, "O02*" to agent 2 and so on, I decided to use one job with a custom module.
The module analyses the ticket title and performs the owner change - so far so good.

My problem is, that the new owner does not get the standard notification which triggers on 'NotificationOwnerUpdate'.
I try to raise the event, but that does not work.

the relevant part of the module below - is there anyone who can give me a hint what I'm doing wrong? :(
Thanks in advance :)

Code: Select all

				
				$LogObject->Log( Priority => 'notice', Message  => 'setting Ticket Owner: '.$Dispatcher, );
					# set Owner and eventually Responsible to desired dispatcher
					my $Success = $TicketObject->TicketOwnerSet(
						TicketID => $Param{TicketID},
						NewUser  => $Dispatcher,
						UserID   => 1,
						SendNoNotification => 0, # optional 1|0 (send no agent and customer notification)
					);
				    my $Success = $TicketObject->TicketLockSet(
						Lock     => 'lock',
						TicketID => $Param{TicketID},
						UserID   => 1,
						SendNoNotification => 0, # optional 1|0 (send no agent and customer notification)
					);
					# clear ticket cache
					# otherwise notification gets its value from old (cached) value
					$TicketObject->_TicketCacheClear( TicketID => $Param{TicketID} );
					# raise event to inform the user
					$Self->EventHandler(
						# Event => 'NotificationOwnerUpdate',
						Event => 'TicketOwnerUpdate',
						Data  => {
							TicketID   => $Param{TicketID},
						},
						UserID => 1,
					);
skullz
Znuny superhero
Posts: 624
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: Trigger event 'NotificationOwnerUpdate' from generic agent custom module

Post by skullz »

After owner set, try to set ticket history also..

i wrote some module almost like this some time ago

https://github.com/mo-azfar/OTRS-Ticket ... on.pm#L181
ernstf
Znuny newbie
Posts: 3
Joined: 18 Mar 2019, 15:30
Znuny Version: 6.0.16
Real Name: Ernst Fichtner
Company: d-con.net
Location: Austria

Re: Trigger event 'NotificationOwnerUpdate' from generic agent custom module

Post by ernstf »

skullz wrote: 03 Sep 2023, 13:28 After owner set, try to set ticket history also..

i wrote some module almost like this some time ago

https://github.com/mo-azfar/OTRS-Ticket ... on.pm#L181
Thank you very much!
That solved my problem, no clearing of cache or EventHandler calling required anymore! :?
Post Reply