Agent Preferences - How to add a field

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

Moderator: crythias

Forum rules
Dont create your support topics here! No new topics with questions allowed!
Post Reply
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Agent Preferences - How to add a field

Post by crythias »

"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 6.0.x (private/testing/public) on Linux with MySQL database.
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
Znuny newbie
Posts: 6
Joined: 25 Jul 2013, 12:25
Znuny Version: 2.2.9

Re: Agent Preferences - How to add a field

Post by handyman »

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
Znuny newbie
Posts: 35
Joined: 21 Feb 2012, 21:33
Znuny Version: OTRS3
Real Name: Javier Gonzalez
Company: Bureau van Dijk

Re: Agent Preferences - How to add a field

Post by pacal »

Hi Guys,

I had the same problem... Are you sure about the path?
Thanks,
Javier
pacal
Znuny newbie
Posts: 35
Joined: 21 Feb 2012, 21:33
Znuny Version: OTRS3
Real Name: Javier Gonzalez
Company: Bureau van Dijk

Re: Agent Preferences - How to add a field

Post by pacal »

forget my previous message, I forgot to put my glasses... Everything works perfectly!
rey90
Znuny newbie
Posts: 70
Joined: 16 Aug 2012, 15:56
Znuny Version: 4.0.10

Re: Agent Preferences - How to add a field

Post by rey90 »

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
Znuny newbie
Posts: 23
Joined: 25 Jul 2014, 15:39
Znuny Version: 3.3.12

Re: Agent Preferences - How to add a field

Post by DBSRAJW »

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
TamaraS
Znuny newbie
Posts: 21
Joined: 25 Feb 2015, 21:51
Znuny Version: 4.0.6
Real Name: Tamara
Location: Bonn, Germany

Re: Agent Preferences - How to add a field

Post by TamaraS »

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
Znuny expert
Posts: 232
Joined: 24 Mar 2015, 16:53
Znuny Version: 5.0.14
Location: Colonia

Re: Agent Preferences - How to add a field

Post by nd0 »

@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
Znuny newbie
Posts: 8
Joined: 20 Apr 2015, 15:33
Znuny Version: 5.0.12
Real Name: Renat Shaimardanov
Company: Agregator
Contact:

Re: Agent Preferences - How to add a field

Post by n0mad »

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 viewtopic.php?f=62&t=24108
elitt
Znuny newbie
Posts: 70
Joined: 08 Jan 2015, 17:01
Znuny Version: 5.0.10
Real Name: Egareg JAOUEN
Company: Elitt

Re: Agent Preferences - How to add a field

Post by elitt »

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
Znuny newbie
Posts: 17
Joined: 07 Dec 2015, 18:19
Znuny Version: 5.0.4
Real Name: Csaba Németh

Re: Agent Preferences - How to add a field

Post by 1soproni »

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 :(
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Agent Preferences - How to add a field

Post by crythias »

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 6.0.x (private/testing/public) on Linux with MySQL database.
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
1soproni
Znuny newbie
Posts: 17
Joined: 07 Dec 2015, 18:19
Znuny Version: 5.0.4
Real Name: Csaba Németh

Re: Agent Preferences - How to add a field

Post by 1soproni »

How does it look like in OTRS 6?
I get Message: Old ConfigItem PreferencesGroups###MyField detected in AgentPrefs-myfield.xml!
barthekk
Znuny newbie
Posts: 9
Joined: 26 Nov 2018, 22:00
Znuny Version: 6.0.12

Re: Agent Preferences - How to add a field

Post by barthekk »

*Bump*. Ive got the same message Old ConfigItem PreferencesGroups###MyField
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Agent Preferences - How to add a field

Post by crythias »

I haven't really tried this but this might work: (Kernel/Config/Files/XML/MyField.xml) Makes sure Prio doesn't conflict.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="2.0" init="Application">
    <Setting Name="PreferencesGroups###MyField" Required="0" Valid="1">
        <Description Translatable="1">A longer discription that describes what this field does</Description>
        <Navigation>Frontend::Agent::View::Preferences</Navigation>
        <Value>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::Preferences::Generic</Item>
                <Item Key="PreferenceGroup">Miscellaneous</Item>
                <Item Key="Label" Translatable="1">My Field label</Item>
                <Item Key="Desc" Translatable="1">Something that describes what this field is about.</Item>
                <Item Key="Key" Translatable="1"></Item>
                <Item Key="Prio">1234</Item>
                <Item Key="Active">1</Item>
            </Hash>
        </Value>
    </Setting>
</otrs_config>
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
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
Post Reply