Agent Preferences - How to add a field

Dont create your support topics here! No new topics with questions allowed!

Moderator: crythias

User avatar
crythias
Moderator
Posts: 9920
Joined: 04 May 2010, 18:38
OTRS Version?: 4.0.x
Location: SouthWest Florida, USA
Contact:

Agent Preferences - How to add a field

Postby crythias » 01 Apr 2013, 20:51

"How do I add an extra field (for instance, phone number) to the Agent DB?"

This is really simple. Create a file (otrs/Kernel/Config/Files/AgentPrefs-myfield.xml)

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="1.0" init="Framework">
    <ConfigItem Name="PreferencesGroups###MyField" Required="0" Valid="1">
        <Description Translatable="1">A message that indicates what this field is for.</Description>
        <Group>Framework</Group>
        <SubGroup>Frontend::Agent::Preferences</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::PreferencesGeneric</Item>
                <Item Key="Column">Other Settings</Item>
                <Item Key="Label" Translatable="1">MyFieldName</Item>
                <Item Key="Key" Translatable="1">MyFieldName</Item>
                <Item Key="Block">Input</Item>
                <Item Key="Data">$Env{"UserMyField"}</Item>
                <Item Key="PrefKey">UserMyField</Item>
                <Item Key="Prio">6100</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Setting>
    </ConfigItem>
</otrs_config>


Note that "Prio" must NOT collide with another entry on the same page.
OTRS 4.0.x (private/testing/public) on Linux with MySQL database. Also on github.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask

handyman
OTRS newbie
Posts: 6
Joined: 25 Jul 2013, 12:25
OTRS Version?: 2.2.9

Re: Agent Preferences - How to add a field

Postby handyman » 25 Jul 2013, 15:37

After u replied to my forum post I tried that out and wondered why it did not integrated into my OTRS. Prolly the path is wrong? Shouldn't it be otrs/Kernel/Config/Files/AgentPrefs-myfield.xml)?

pacal
OTRS newbie
Posts: 35
Joined: 21 Feb 2012, 21:33
OTRS Version?: OTRS3
Real Name: Javier Gonzalez
Company: Bureau van Dijk

Re: Agent Preferences - How to add a field

Postby pacal » 09 Oct 2013, 18:22

Hi Guys,

I had the same problem... Are you sure about the path?
Thanks,
Javier

pacal
OTRS newbie
Posts: 35
Joined: 21 Feb 2012, 21:33
OTRS Version?: OTRS3
Real Name: Javier Gonzalez
Company: Bureau van Dijk

Re: Agent Preferences - How to add a field

Postby pacal » 11 Oct 2013, 14:32

forget my previous message, I forgot to put my glasses... Everything works perfectly!

rey90
OTRS expert
Posts: 70
Joined: 16 Aug 2012, 15:56
OTRS Version?: 4.0.10

Re: Agent Preferences - How to add a field

Postby rey90 » 20 Jun 2014, 14:16

not for me. Any hint where to have a look? Debugging options?
Produktiv: OTRS: 4.0.10
Testing": OTRS: 5
OS: Debian 7
Apache2/MySQL 5

DBSRAJW
OTRS newbie
Posts: 23
Joined: 25 Jul 2014, 15:39
OTRS Version?: 3.3.12

Re: Agent Preferences - How to add a field

Postby DBSRAJW » 11 Sep 2014, 14:07

As so often reading ideas about enhancements of crythias; they are running fine! Really, I appreciate your work and it helped me already so often, thank you very much for helping!

I added several ConfigItems to my configuration and made some changes regarding the preferences, I would like to share with the community.

And one important step: after uploading the file to the otrs folder Kernel/Config/Files/ the admin has to go at least 1 time to >>admin >> SysConfig to rebuild the new config of OTRS.
Afterwards a new SysConfig entry in Framework -> Frontend::Agent::Preferences is added for each ConfigItem, you added via the xml file.

Additionally the new field content can be added via Preferences (below the password field) and the fields are available in the signatures for example using this format:

Format in XML File:

Code: Select all

                <Item Key="Data">$Env{"UserMyFieldDepartmentCode"}</Item>
                <Item Key="PrefKey">UserMyFieldDepartmentCode</Item>


Format to be used e.g. as signature:


Code: Select all

Mit freundlichen Grüßen / Best regards
<OTRS_Agent_UserFirstname> <OTRS_Agent_UserLastname>

<OTRS_CURRENT_UserMyFieldPosition>
<OTRS_CURRENT_UserMyFieldDepartment>
[i]
Name of company
Address of company[/i]
Tel.: <OTRS_CURRENT_UserMyFieldPhoneNo>
Mobil:  <OTRS_CURRENT_UserMyFieldMobileNo>
E-Mail (for topic replies): [i]system-email-address[/i]
E-Mail (personal to creator): <OTRS_CURRENT_UserMyFieldEmail>



Attached you can find my own xml config file, which can be adjusted and uploaded to path mentioned above.
You do not have the required permissions to view the files attached to this post.
OTRS version: 3.3.12
Operating System: VM / Debian7
Database type: MySQL

User avatar
TamaraS
OTRS newbie
Posts: 21
Joined: 25 Feb 2015, 21:51
OTRS Version?: 4.0.6
Real Name: Tamara
Location: Bonn, Germany

Re: Agent Preferences - How to add a field

Postby TamaraS » 27 Mar 2015, 16:47

This is really a nice feature.
I added all fields I need. The blank fields are now available at agents preferences.

But I stuck on the Config.pm-settings to sync the new data from AD.
The part for my supportagents now looks like:

Code: Select all

$Self->{'AuthModule1'} = 'Kernel::System::Auth::LDAP';
$Self->{'AuthModule::LDAP::Host1'} = 'dc1.domain.loc';
$Self->{'AuthModule::LDAP::BaseDN1'} = 'DC=domain,DC=loc';
$Self->{'AuthModule::LDAP::UID1'} = 'samaccountname';
$Self->{'AuthModule::LDAP::GroupDN1'} = 'CN=Group-otrsagents,OU=Groups,DC=domain,DC=loc';
$Self->{'AuthModule::LDAP::AccessAttr1'} = 'member'; #
$Self->{'AuthModule::LDAP::UserAttr1'} = 'DN';
$Self->{'AuthModule::LDAP::SearchUserDN1'} = 'CN=otrs,OU=Users,DC=domain,DC=loc';
$Self->{'AuthModule::LDAP::SearchUserPw1'} = 'myverysecretpassword';

$Self->{'UserSyncLDAPMap1'} =  {
  'UserEmail' => 'mail',
  'UserFirstname' => 'givenName',
  'UserLastname' => 'sn',
  'UserLogin' => 'sAMAccountName'.
  'UserMyFieldPosition' => 'title'.
  'UserMyFieldAbteilung' => 'department'.
  'UserMyFieldBuero' => 'physicalDeliveryOfficeName'.
  'UserMyFieldTelefon' => 'telephoneNumber'.
  'UserMyFieldMobil' => 'mobile'.
  'UserMyFieldFax' => 'facsimileTelephoneNumber',
  'UserMyFieldPersonaltyp' => 'employeeType',
  'UserMyFieldPersonalnr' => 'employeeID'
    };

nd0
OTRS superhero
Posts: 232
Joined: 24 Mar 2015, 16:53
OTRS Version?: 5.0.14
Location: Colonia

Re: Agent Preferences - How to add a field

Postby nd0 » 08 Apr 2015, 16:54

@TamaraS:

Code: Select all

$Self->{'AuthModule1'} = 'Kernel::System::Auth::LDAP';
$Self->{'AuthModule::LDAP::Host1'} = 'dc1.domain.loc';
$Self->{'AuthModule::LDAP::BaseDN1'} = 'DC=domain,DC=loc';
$Self->{'AuthModule::LDAP::UID1'} = 'samaccountname';
$Self->{'AuthModule::LDAP::GroupDN1'} = 'CN=Group-otrsagents,OU=Groups,DC=domain,DC=loc';
$Self->{'AuthModule::LDAP::AccessAttr1'} = 'member'; #
$Self->{'AuthModule::LDAP::UserAttr1'} = 'DN';
$Self->{'AuthModule::LDAP::SearchUserDN1'} = 'CN=otrs,OU=Users,DC=domain,DC=loc';
$Self->{'AuthModule::LDAP::SearchUserPw1'} = 'myverysecretpassword';

$Self->{'UserSyncLDAPMap1'} =  {
  'UserEmail' => 'mail',
  'UserFirstname' => 'givenName',
  'UserLastname' => 'sn',
  'UserLogin' => 'sAMAccountName'. ### !!!
  'UserMyFieldPosition' => 'title'. ### !!!
  'UserMyFieldAbteilung' => 'department'. ### !!!
  'UserMyFieldBuero' => 'physicalDeliveryOfficeName'. ### !!!
  'UserMyFieldTelefon' => 'telephoneNumber'. ### !!!!
  'UserMyFieldMobil' => 'mobile'. ### !!!
  'UserMyFieldFax' => 'facsimileTelephoneNumber',
  'UserMyFieldPersonaltyp' => 'employeeType',
  'UserMyFieldPersonalnr' => 'employeeID'
    };


Please try it with "," instead of "." ;-)
LIVE: OTRS 5.0.14 || Debian || MySQL/LDAP
TEST: OTRS 5.0.14 || Debian || MySQL/LDAP

n0mad
OTRS newbie
Posts: 8
Joined: 20 Apr 2015, 15:33
OTRS Version?: 5.0.12
Real Name: Renat Shaimardanov
Company: Agregator
Contact:

Re: Agent Preferences - How to add a field

Postby n0mad » 21 Apr 2015, 08:43

TamaraS wrote:This is really a nice feature.
I added all fields I need. The blank fields are now available at agents preferences.

But I stuck on the Config.pm-settings to sync the new data from AD.
The part for my supportagents now looks like:


Hi Tamara

Check out this link http://forums.otterhub.org/viewtopic.php?f=62&t=24108

User avatar
elitt
OTRS expert
Posts: 66
Joined: 08 Jan 2015, 17:01
OTRS Version?: 5.0.10
Real Name: Egareg JAOUEN
Company: Elitt

Re: Agent Preferences - How to add a field

Postby elitt » 24 Aug 2015, 18:19

Is it possible to use textarea field instead of input ones ?
For example, I'd like to put the company address into the signature in that way :
<Company name>
<Street>
<City>

May I use one textarea field or must I use three input fields ?
OTRS v5.0.10 on Fedora25 with posgreSQL 9.4.9 database

1soproni
OTRS newbie
Posts: 12
Joined: 07 Dec 2015, 18:19
OTRS Version?: 5.0.4
Real Name: Csaba Németh

Re: Agent Preferences - How to add a field

Postby 1soproni » 09 Dec 2015, 09:24

crythias wrote:"How do I add an extra field (for instance, phone number) to the Agent DB?"

This is really simple. Create a file (otrs/Kernel/Config/Files/AgentPrefs-myfield.xml)

How will it survive the upgrades?
I tried to put it into otrs/Custom/Kernel/Config/Files/AgentPrefs-myfield.xml, but it didn't work :(

User avatar
crythias
Moderator
Posts: 9920
Joined: 04 May 2010, 18:38
OTRS Version?: 4.0.x
Location: SouthWest Florida, USA
Contact:

Re: Agent Preferences - How to add a field

Postby crythias » 09 Dec 2015, 16:18

1soproni wrote:How will it survive the upgrades?
I tried to put it into otrs/Custom/Kernel/Config/Files/AgentPrefs-myfield.xml, but it didn't work

It will survive the upgrade because you will copy the file to the upgrade location.
You can put the file in otrs/Kernel/Config/Files directly and because it's a self-contained file, you can disable or add the feature simply by removing or adding the file and rebuilding config, either by command line or visiting Admin, SysConfig.
OTRS 4.0.x (private/testing/public) on Linux with MySQL database. Also on github.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask


Return to “Howtos”

Who is online

Users browsing this forum: No registered users and 1 guest

cron