Adding selection fields to customer

Moderator: crythias

Post Reply
fondofotrs
Znuny newbie
Posts: 42
Joined: 13 Jan 2011, 09:40
Znuny Version: 3.04

Adding selection fields to customer

Post by fondofotrs »

hi,

i understand that we can add new customer fields and it has been given in the admin doc. can some one tell me how to add selection type fields to customer? for ex, when you add customer, there are fields like valid, Theme etc from which the values can be selected. i would like to add similar new fields to customer. any help can be great.

tx
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Adding selection fields to customer

Post by crythias »

Take a look at Config.pm or Defaults.pm

Code: Select all

1391	            # note: Login, Email and CustomerID needed!
1392	            # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target
1393	            [ 'UserTitle',      'Title',      'title',      1, 0, 'var', '', 0 ],
1394	            [ 'UserFirstname',  'Firstname',  'first_name', 1, 1, 'var', '', 0 ],
1395	            [ 'UserLastname',   'Lastname',   'last_name',  1, 1, 'var', '', 0 ],
1396	            [ 'UserLogin',      'Username',   'login',      1, 1, 'var', '', 0 ],
1397	            [ 'UserPassword',   'Password',   'pw',         0, 0, 'var', '', 0 ],
1398	            [ 'UserEmail',      'Email',      'email',      1, 1, 'var', '', 0 ],
1399	
1400	#            [ 'UserEmail',      'Email', 'email',           1, 1, 'var', '$Env{"CGIHandle"}?Action=AgentTicketCompose&ResponseID=1&TicketID=$Data{"TicketID"}&ArticleID=$Data{"ArticleID"}', 0 ],
1401	            [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ],
1402	
1403	#            [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
1404	            [ 'UserPhone',        'Phone',       'phone',        1, 0, 'var', '', 0 ],
1405	            [ 'UserFax',          'Fax',         'fax',          1, 0, 'var', '', 0 ],
1406	            [ 'UserMobile',       'Mobile',      'mobile',       1, 0, 'var', '', 0 ],
1407	            [ 'UserStreet',       'Street',      'street',       1, 0, 'var', '', 0 ],
1408	            [ 'UserZip',          'Zip',         'zip',          1, 0, 'var', '', 0 ],
1409	            [ 'UserCity',         'City',        'city',         1, 0, 'var', '', 0 ],
1410	            [ 'UserCountry',      'Country',     'country',      1, 0, 'var', '', 0 ],
1411	            [ 'UserComment',      'Comment',     'comments',     1, 0, 'var', '', 0 ],
1412	            [ 'ValidID',          'Valid',       'valid_id',     0, 1, 'int', '', 0 ],
1413	        ],
1414	
1415	        # default selections
1416	        Selections => {
1417	
1418	#            UserTitle => {
1419	#                'Mr.' => 'Mr.',
1420	#                'Mrs.' => 'Mrs.',
1421	#            },
So, if you want a selection for a custom field, you'll have to properly define it in the database, insert the entry into the Map in Config.pm. You'll want to copy the entire database section from Defaults.pm:
['WhatVariableNameIsUsedToReferenceTheField', 'WhatDisplaysAsTheLabel', 'WhatFieldTheDatabaseUsesToStoreTheData', whetherTheFieldIsShown, whetherTheFieldIsRequired, 'typeOfField', 'optionalhttp://linktosomewhereifclicked', 'read-only?'],

Then in Selections:

Code: Select all

    WhatVariableNameYouChoseAbove => {
        'Key' => 'Value',
        'Key2' => 'Value2',
},
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
fondofotrs
Znuny newbie
Posts: 42
Joined: 13 Jan 2011, 09:40
Znuny Version: 3.04

<Closed>Adding selection fields to customer

Post by fondofotrs »

thanks, Crythias. it works like a charm.
asdrub
Znuny newbie
Posts: 3
Joined: 07 Aug 2010, 05:51
Znuny Version: 2.4.7

Re: Adding selection fields to customer

Post by asdrub »

This post was very useful to me.
But, if I want to set the default "selected" option in the Selections list?

Thanks in advance
Eduardo Ribeiro

OTRS 2.4 [FreeBSD] and 3.0 [CentOS 6 Linux], both on VMware and MS Hyper-V, with MySQL database for Agents and Customers.
Post Reply