Show Customer Data in Dashboard

From OtterHub - OTRS Community Wiki
Jump to: navigation, search

In OTRS you can expand templates to also show different data then OTRS provides. For this you can use the Data tags; the only thing is you can actually only use the tags for which data is available. Let's assume you want to show Customer information in the Dashboard. If you look closely to the file, which is the file that generated the HTML needed for the ticket overviews in the dashboard, you'll notice that by default only Ticket data is passed to the layout object, and the ticket data does not include customer information, only the customer login and customer ID.

Below you'll see how to patch the file so you can use Customer data in Kernel/Output/HTML/Standard/AgentDashboardTicketGeneric.dtl to display extra customer information.

Please note that the dashboard uses caching of results, so when developing you'll need to maybe run bin/ a few times.

The tags you'll have available will differ from setup to setup, because they're the tags you've configured in your customer data source. On a vanilla system they will include


If you'll also want to display Company information, you'll need to look up the Company in much the same way.

Index: Kernel/Output/HTML/
RCS file: /home/cvs/otrs/Kernel/Output/HTML/,v
retrieving revision 1.39
diff -u -r1.39
--- Kernel/Output/HTML/	5 Apr 2011 12:04:34 -0000	1.39
+++ Kernel/Output/HTML/	23 May 2011 08:53:23 -0000
@@ -31,6 +31,8 @@
         die "Got no $_!" if ( !$Self->{$_} );
+    $Self->{CustomerUserObject} = Kernel::System::CustomerUser->new(%Param);
     # get current filter
     my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || ;
@@ -325,11 +327,20 @@
                 Space => ' ',
+        my %CustomerUser;
+        # lookup customer
+        if ( $Ticket{CustomerUserID} ) {
+            %CustomerUser = $Self->{CustomerUserObject}->CustomerUserDataGet(
+                User => $Ticket{CustomerUserID},
+            );
+        }
+        my %Data=(%Ticket, %CustomerUser);
         # show ticket
             Name => 'ContentLargeTicketGenericRow',
-            Data => \%Ticket,
+            Data => \%Data,
         # show ticket flags