View all user deatils on User Information


#1

Hi,
I have created custom fields for a user , I would like view these details under user summary of a ticket. I have given the user rights to view custom fields .
How do I achieve this ?


#2

You can do this with a callback called ‘Modify’ to the ShowUser element. If you’ve not used Callbacks before, they’re bits of code (using the HTML::Template system that RT uses) that get called before/after various things are displayed in RT, giving you the option to make local tweaks to the display without altering the actual code base. To set them up, under your RT root directory (usually something like /opt/rt4 but it can vary if you’ve used a pre-packaged version of RT from a Linux distribution or put it somewhere different yourself) create this directory path:

local/html/Callbacks/MyCallbacks/Elements/ShowUser

Then in that ShowUser directory create a file called Modify that will contain your callback. Here’s a starter for you that looks for a User Custom field called “Shoe Size” and, if filled in for a user, displays it after the user’s name/email:

<%init>
my $shoeSize = $User->FirstCustomFieldValue('Shoe Size');
if($shoeSize) {
  $$display .= " Shoe Size: $shoeSize";
}
</%init>
<%args>
$display => undef
$User => undef
$Address         => undef
$system_user     => undef
</%args>

Then blow away your Mason cache and restart the web server as normal after making a change, give a user a value in the “Shoe Size” custom field and away you go. Obviously you may want a different custom field than “Shoe Size” unless you happen to be running RT at a cobblers shop. :slight_smile:


#3

I have looked for a folder named in ShowUser and noticed that it is a file having the location
“/opt/rt4/share/html/Elements/ShowUser”

I am using RT 4.4.3


#4

Yes, that’s the actual code shipped with RT. The callback directory structure you need to create yourself (see my posting above) in your local directory structure so that you can make the modification you want to the default behaviour.