Notification Template (.tt) [% Data.* %] Fields

Moderator: crythias

Locked
Lopson
Znuny newbie
Posts: 3
Joined: 25 Feb 2016, 12:57
Znuny Version: 5.0.4

Notification Template (.tt) [% Data.* %] Fields

Post by Lopson »

Hi everyone. I've been trying to make an E-mail template for Notifications (/opt/otrs/Kernel/Output/HTML/Templates/Standard/NotificationEvent/Email). In this template, I try to get a ticket's number, its queue and its title. I'm trying to do this by using [% Data.TicketNumber %], [% Data.Title %], and [% Data.QueueName %].

Unfortunately, these variables don't seem to work, seeing as they produce only empty strings. As such, I ask: what can be accessed through this template mechanism in this specific case? I cannot, for the life of me, find any kind of list of variables that are usable in Notification template files.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Notification Template (.tt) [% Data.* %] Fields

Post by RStraub »

Don't the OTRS-Smarttags work? Like so:

Code: Select all

<OTRS_TICKET_TicketNumber>
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Lopson
Znuny newbie
Posts: 3
Joined: 25 Feb 2016, 12:57
Znuny Version: 5.0.4

Re: Notification Template (.tt) [% Data.* %] Fields

Post by Lopson »

Using the Smart Tags in the template file (.tt file) doesn't work. I've just tested it by writing both <TAG_NAME> and <TAG_NAME> directly in the template file. Again, I'm not trying to do something through the frontend, but rather through files in the OTRS installation.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Notification Template (.tt) [% Data.* %] Fields

Post by RStraub »

Well in that case you need to pass the according %Ticket hash to the part where the template is called. In the .pm file there should be something like this (an example from AdminNotification.pm as I don't use 5.x yet):

Code: Select all

$Self->{LayoutObject}->Output(
        TemplateFile => 'AdminNotification',
        Data         => \%Param
    );
this should be changed to (and of course the %Ticket should hold the result of the current ticket):

Code: Select all

$Self->{LayoutObject}->Output(
        TemplateFile => 'AdminNotification',
        Data         => { \%Param, \%Ticket},
    );
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Lopson
Znuny newbie
Posts: 3
Joined: 25 Feb 2016, 12:57
Znuny Version: 5.0.4

Re: Notification Template (.tt) [% Data.* %] Fields

Post by Lopson »

Thanks for answering back. The OTRS installation in which I'm trying to do this has an active Business Basic license. If I alter one of the many .pm files in the installation, won't that void the "warranty" in some way?
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Notification Template (.tt) [% Data.* %] Fields

Post by RStraub »

You can move them to the ~otrs/Custom folder first. That way it's easy to roll back but you'll also keep your modifications on updates.

If you have a contract with OTRS, you could always ask them, what would be the recommended way to fix your problem.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Locked