What's a Ticket Event?
When a ticket does an action, this can do something based upon that action method.
What kind of action methods can I use/run against?
https://github.com/OTRS/TemplateModule/ ... mplate.xml
ArticleAgentNotification
ArticleAutoResponse
ArticleBounce
ArticleCreate
ArticleCustomerNotification
ArticleFlagDelete
ArticleFlagSet
ArticleFreeTextUpdate
ArticleSend
ArticleUpdate
HistoryAdd
HistoryDelete
TicketAccountTime
TicketCreate
TicketCustomerUpdate
TicketDelete
TicketFreeTextUpdate
TicketFreeTimeUpdate
TicketLockUpdate
TicketMerge
TicketOwnerUpdate
TicketPendingTimeUpdate
TicketPriorityUpdate
TicketQueueUpdate
TicketResponsibleUpdate
TicketServiceUpdate
TicketSLAUpdate
TicketStateUpdate
TicketTitleUpdate
TicketTypeUpdate
TicketUnlockTimeoutUpdate
What do I need?
- An idea.
- An editor.
- A grasp of the perl language.
- A link to the API
- An XML file in Kernel/Config/Files pointing to the TicketEvent
- A TicketEventYourInfoHere.pm in Kernel/System/Ticket/Event/
Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="1.0" init="Changes">
<ConfigItem Name="Ticket::EventModulePost###EventModulePostTemplate" Required="0" Valid="1">
<Description Lang="en"></Description>
<Description Lang="de"></Description>
<Group>EventModulePostTemplate</Group>
<SubGroup>EventModule</SubGroup>
<Setting>
<Hash>
<Item Key="Module">Kernel::System::Ticket::Event::EventModulePostTemplate</Item>
<Item Key="Event">(ArticleAgentNotification|ArticleAutoResponse|ArticleBounce|ArticleCreate|ArticleCustomerNotification|ArticleFlagDelete|ArticleFlagSet|ArticleFreeTextUpdate|ArticleSend|ArticleUpdate|HistoryAdd|HistoryDelete|TicketAccountTime|TicketCreate|TicketCustomerUpdate|TicketDelete|TicketFreeTextUpdate|TicketFreeTimeUpdate|TicketLockUpdate|TicketMerge|TicketOwnerUpdate|TicketPendingTimeUpdate|TicketPriorityUpdate|TicketQueueUpdate|TicketResponsibleUpdate|TicketServiceUpdate|TicketSLAUpdate|TicketStateUpdate|TicketTitleUpdate|TicketTypeUpdate|TicketUnlockTimeoutUpdate)</Item>
</Hash>
</Setting>
</ConfigItem>
</otrs_config>
- <ConfigItem Name="Ticket::EventModulePost###EventModulePostTemplate" Required="0" Valid="1"> (Ticket::EventModulePost is always this. Grouping maybe something else, but Ticket::EventModulePost is required. After ###, anything you want to say.)
- <Item Key="Module">Kernel::System::Ticket::Event::EventModulePostTemplate</Item> Path is important, but name (EventModulePostTemplate) isn't. Just make sure the file it references exists in the path, and has a Package name (inside the file)that is the same thing. The Package name should be the same as the path without the .pm
- <Item Key="Event"> Every event is listed here. You don't need all of them, just the ones that you want to call your event. Use parentheses when referencing more than one: (TicketLockUpdate|TicketMerge)
https://github.com/OTRS/TemplateModule/ ... emplate.pm
Most critical:
Code: Select all
package Kernel::System::Ticket::Event::EventModulePostTemplate;
Built-in Objects that can be used:
ConfigObject CustomerGroupObject CustomerUserObject DBObject EncodeObject GroupObject
HTMLUtilsObject LinkObject LockObject LogObject LoopProtectionObject MainObject
PriorityObject QueueObject SendmailObject ServiceObject SLAObject StateObject
TicketObject TimeObject TypeObject UserObject ValidObject
You need a sub new { } and a sub Run{ }
the sub new { ... } is standard fare. Just copy it and paste it.
the sub Run { ... } is where the action is. Remember that all of the above list also creates Events. Avoid making an infinite loop event, such as an event that reacts to HistoryAdd and then uses the API which triggers a HistoryAdd event.