Custom Field on "Add Customer" page

Moderator: crythias

Post Reply
QAGZZZ
OTRS newbie
Posts: 5
Joined: 13 Sep 2011, 19:46
OTRS Version?: 2.4

Custom Field on "Add Customer" page

Post by QAGZZZ »

Hi everyone!

We have been using OTRS at my company for quite some time now and are very satisfied with it.

Based on these results we would like to go further and start saving all of our customers' information in OTRS. In order to do this we would like to add text and date fields in the "Add Customer" page. Should this be possible I would appreciate help in order to do it.

Thanks in advance!
QAGZZZ

renee
OTRS expert
Posts: 241
Joined: 06 Feb 2009, 11:15
OTRS Version?: 3.0.x
Company: Perl-Services.de
Contact:

Re: Custom Field on "Add Customer" page

Post by renee »

First, you have to add those fields in the database, so that the values can be stored... Then you have to do the following steps:

If you haven't changed the CustomerUser-Settings in <OTRS_HOME>/Kernel/Config.pm
1) Copy all the code

Code: Select all

$Self->{CustomerUser} = {
        Name   => 'Database Backend',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
            Table => 'customer_user',
            # CaseSensitive will control if the SQL statements need LOWER()
            #   function calls to work case insensitively. Setting this to
            #   1 will improve performance dramatically on large databases.
            CaseSensitive => 0,
        },

        # customer uniq id
        CustomerKey => 'login',

        # customer #
        CustomerID             => 'customer_id',
        CustomerValid          => 'valid_id',
        CustomerUserListFields => [ 'first_name', 'last_name', 'email' ],
        CustomerUserSearchFields           => [ 'login', 'first_name', 'last_name', 'customer_id' ],
        CustomerUserSearchPrefix           => '*',
        CustomerUserSearchSuffix           => '*',
        CustomerUserSearchListLimit        => 250,
        CustomerUserPostMasterSearchFields => ['email'],
        CustomerUserNameFields     => [ 'title', 'first_name', 'last_name' ],
        CustomerUserEmailUniqCheck => 1,
        Map => [

            # note: Login, Email and CustomerID needed!
            # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target
            [ 'UserTitle',      'Title',      'title',      1, 0, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'first_name', 1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'last_name',  1, 1, 'var', '', 0 ],
            [ 'UserLogin',      'Username',   'login',      1, 1, 'var', '', 0 ],
            [ 'UserPassword',   'Password',   'pw',         0, 0, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'email',      1, 1, 'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
            [ 'UserPhone',        'Phone',       'phone',        1, 0, 'var', '', 0 ],
            [ 'UserFax',          'Fax',         'fax',          1, 0, 'var', '', 0 ],
            [ 'UserMobile',       'Mobile',      'mobile',       1, 0, 'var', '', 0 ],
            [ 'UserStreet',       'Street',      'street',       1, 0, 'var', '', 0 ],
            [ 'UserZip',          'Zip',         'zip',          1, 0, 'var', '', 0 ],
            [ 'UserCity',         'City',        'city',         1, 0, 'var', '', 0 ],
            [ 'UserCountry',      'Country',     'country',      1, 0, 'var', '', 0 ],
            [ 'UserComment',      'Comment',     'comments',     1, 0, 'var', '', 0 ],
            [ 'ValidID',          'Valid',       'valid_id',     0, 1, 'int', '', 0 ],
        ],

        # default selections
        Selections => {
        },
    };
into <OTRS_HOME>/Kernel/Config.pm

2) Edit the map to include the new fields, e.g.

Code: Select all

        Map => [

            # note: Login, Email and CustomerID needed!
            # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target
            [ 'UserTitle',      'Title',      'title',      1, 0, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'first_name', 1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'last_name',  1, 1, 'var', '', 0 ],
            [ 'UserLogin',      'Username',   'login',      1, 1, 'var', '', 0 ],
            [ 'UserPassword',   'Password',   'pw',         0, 0, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'email',      1, 1, 'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
            [ 'UserPhone',        'Phone',       'phone',        1, 0, 'var', '', 0 ],
            [ 'UserFax',          'Fax',         'fax',          1, 0, 'var', '', 0 ],
            [ 'UserMobile',       'Mobile',      'mobile',       1, 0, 'var', '', 0 ],
            [ 'UserStreet',       'Street',      'street',       1, 0, 'var', '', 0 ],
            [ 'UserZip',          'Zip',         'zip',          1, 0, 'var', '', 0 ],
            [ 'UserCity',         'City',        'city',         1, 0, 'var', '', 0 ],
            [ 'UserCountry',      'Country',     'country',      1, 0, 'var', '', 0 ],

            [ 'UserColumn1', 'New Column', 'column_name_in_table', 1, 0, 'var', '', 0 ], # This is a new column

            [ 'UserComment',      'Comment',     'comments',     1, 0, 'var', '', 0 ],
            [ 'ValidID',          'Valid',       'valid_id',     0, 1, 'int', '', 0 ],
        ],
The order in the map represents the order in the form!


If you have already changed CustomerUser-settings in the Config.pm, you have to do only step 2 (change the map).
Need a Perl/OTRS developer? You can contact me at info@perl-services.de

QAGZZZ
OTRS newbie
Posts: 5
Joined: 13 Sep 2011, 19:46
OTRS Version?: 2.4

Re: Custom Field on "Add Customer" page

Post by QAGZZZ »

much appreciated!
:)
thank you!

RBehr
OTRS expert
Posts: 167
Joined: 26 Jan 2011, 13:23
OTRS Version?: 3.0.7
Real Name: Rod Behr
Company: Impact
Location: London, United Kingdom
Contact:

Re: Custom Field on "Add Customer" page

Post by RBehr »

This has been hugely helpful.

One question: I want a field to contain a URL. Using the Map I can create a static URL (whenever the field is clicked it goes to the same URL), however I want it to point to the URL of the field value, so if the field contains www.google.co.uk, clicking it takes the user to www.google.co.uk. How can this be achieved? With a CI, simply entering a URL into a varchar fields makes that field into a URL. I want the same for a customer with custom mapped fields.

Thanks
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3

crythias
Moderator
Posts: 10121
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Custom Field on "Add Customer" page

Post by crythias »

You can use http-link. viewtopic.php?f=60&t=7787
OTRS 5.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

RBehr
OTRS expert
Posts: 167
Joined: 26 Jan 2011, 13:23
OTRS Version?: 3.0.7
Real Name: Rod Behr
Company: Impact
Location: London, United Kingdom
Contact:

Re: Custom Field on "Add Customer" page

Post by RBehr »

Excellent. That's exactly what I was looking for. Thanks Crythias!
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3

figozz
OTRS newbie
Posts: 7
Joined: 12 Oct 2012, 12:12
OTRS Version?: 3.1.10
Real Name: Steve

Re: Custom Field on "Add Customer" page

Post by figozz »

Thanks. Have managed to do it now.

MikeDelta
OTRS newbie
Posts: 33
Joined: 13 Jan 2015, 13:26
OTRS Version?: 4.0.4

Re: Custom Field on "Add Customer" page

Post by MikeDelta »

Is this still the actual procedure?
I am on OTRS 4.0.4
Thank you :)

reneeb
OTRS guru
Posts: 4797
Joined: 13 Mar 2011, 09:54
OTRS Version?: 3.3.x
Company: Perl-Services.de
Contact:

Re: Custom Field on "Add Customer" page

Post by reneeb »

yes
Perl / OTRS development: http://perl-services.de
Free OTRS add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de

martinaiphs
OTRS newbie
Posts: 1
Joined: 05 Oct 2017, 11:33
OTRS Version?: OTRS5
Real Name: Martina Hirsch

Re: Custom Field on "Add Customer" page

Post by martinaiphs »

You can make your own custom fields in your customer entre form and grow customer information as and be considering you understand them. You can pick to have these custom fields visible and/or editable to your agents and customers.
You can with grow custom fields to Companies and permit agents whole more mention going approximately for the various companies you realize issue later. This habit, your agents have improved context though dealing once than customers and they can prioritize tickets based upon this hint.
Custom Software Development Company, Mobile App Development Company

heeg2au
OTRS newbie
Posts: 37
Joined: 14 Jan 2015, 17:36
OTRS Version?: 6.0.27
Real Name: Helmut

Re: Custom Field on "Add Customer" page

Post by heeg2au »

Hi everybody,
here's the question once again: is this still the current procedure (we're on 6.0.27)? There is an option now to add dynamic fields for customers and customer users but I haven't found a sysconfig setting to make them appear in the respective forms.
Thanks a lot in advance,
Helmut
OTRS 6.0.27 (productive)
Extensions: ITSM (SLM, IncidentProblem, Change, Configuration), FAQ, Survey, CMDB Explorer, ImportExport, EscalationPlus

heeg2au
OTRS newbie
Posts: 37
Joined: 14 Jan 2015, 17:36
OTRS Version?: 6.0.27
Real Name: Helmut

Re: Custom Field on "Add Customer" page

Post by heeg2au »

heeg2au wrote:
31 Mar 2020, 08:19
Hi everybody,
here's the question once again: is this still the current procedure (we're on 6.0.27)? There is an option now to add dynamic fields for customers and customer users but I haven't found a sysconfig setting to make them appear in the respective forms.
Thanks a lot in advance,
Helmut
Sorry, just saw that my signature contained old version information ;)
OTRS 6.0.27 (productive)
Extensions: ITSM (SLM, IncidentProblem, Change, Configuration), FAQ, Survey, CMDB Explorer, ImportExport, EscalationPlus

skullz
OTRS expert
Posts: 279
Joined: 24 Feb 2012, 03:58
OTRS Version?: OTRS 6
Real Name: Skullz
Contact:

Re: Custom Field on "Add Customer" page

Post by skullz »

After add the field via dynamic field, you still need to define them in Config.pm (CustomerUser mapping) .

https://blog.otrs.com/2017/10/25/otrs-6 ... omer-user/

heeg2au
OTRS newbie
Posts: 37
Joined: 14 Jan 2015, 17:36
OTRS Version?: 6.0.27
Real Name: Helmut

Re: Custom Field on "Add Customer" page

Post by heeg2au »

skullz wrote:
31 Mar 2020, 11:36
After add the field via dynamic field, you still need to define them in Config.pm (CustomerUser mapping) .

https://blog.otrs.com/2017/10/25/otrs-6 ... omer-user/
Thanks for the fast reply, skullz. I'll give that a try in the next couple of days and will post the result here :)
OTRS 6.0.27 (productive)
Extensions: ITSM (SLM, IncidentProblem, Change, Configuration), FAQ, Survey, CMDB Explorer, ImportExport, EscalationPlus

Post Reply