Hi,
I'm running a custom module (i.e. Custom/GeTModules/AutoWatch.pm) through generic agent, called when a new article is created.
Is there a way to get the id of the agent who is connected and who added the article that called the generic agent?
Thank you for your help.
Gérald
get id of connected agent in custom module
-
- Znuny newbie
- Posts: 36
- Joined: 10 Mar 2023, 16:38
- Znuny Version: znuny 6.5.1
- Real Name: Gérald Salin
- Company: INRAE - GeT-PlaGe
get id of connected agent in custom module
--
znuny 6.5.6
postgresql 13
Rocky 8
znuny 6.5.6
postgresql 13
Rocky 8
-
- Administrator
- Posts: 3981
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: get id of connected agent in custom module
Hi Gérald,
it might be UserID but to do something on an article creation I recommend using an event module. Here a small example with code: https://github.com/znuny/Znuny/blob/rel ... rCreate.pm and then you need the module registration like this:
- Roy
it might be UserID but to do something on an article creation I recommend using an event module. Here a small example with code: https://github.com/znuny/Znuny/blob/rel ... rCreate.pm and then you need the module registration like this:
Code: Select all
<Setting Name="Ticket::EventModulePost###8000-MyEventModule" Required="0" Valid="1">
<Description Translatable="1">Just say what it does.</Description>
<Navigation>Core::Event::Ticket</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::System::Ticket::Event::MyModule</Item>
<Item Key="Event">ArticleCreate</Item>
<Item Key="Transaction">1</Item>
</Hash>
</Value>
</Setting>
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 ?
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 ?
-
- Znuny newbie
- Posts: 36
- Joined: 10 Mar 2023, 16:38
- Znuny Version: znuny 6.5.1
- Real Name: Gérald Salin
- Company: INRAE - GeT-PlaGe
Re: get id of connected agent in custom module
Hi Roy,
thank you for your help....
I will explain my need, and what I've done so far..
My first goal : allow an agent who answers a ticket to become watcher by default
TO achieve this,
I would like to do the same thing without the need to send an email, through bulk actions.
My new goal : allow an agent to unwatch multiple tickets through bulk actions, without writing a new article
To achieve this :
My problem : get the userId f the connected agent....
Thank you for your help
Gérald
thank you for your help....
I will explain my need, and what I've done so far..
My first goal : allow an agent who answers a ticket to become watcher by default
TO achieve this,
- I created a custom module, called via Generic AGent on article creation
I created a dynamic field "Do not watch this ticket" which is displayed on new article creation : if the agent select this dynamic field, he is not defined, or removed from watchers, else he is added as a watcher on this ticket
I would like to do the same thing without the need to send an email, through bulk actions.
My new goal : allow an agent to unwatch multiple tickets through bulk actions, without writing a new article
To achieve this :
- select one or more tickets
click on Bulk actions
display my dynamic field "Do not watch this ticket"
call a generic agent on ticket dynamic field "Do not watch this ticket" update
My problem : get the userId f the connected agent....
Thank you for your help
Gérald
--
znuny 6.5.6
postgresql 13
Rocky 8
znuny 6.5.6
postgresql 13
Rocky 8