Adding a new CustomField type

Hi all,

I was originally wanting to add new CustomField types to enable things
like showing a flag for “Country” in addition to the text. But I just
realized I think I can do w/o a new type by using the
ShowComponentName Callback in Elements/ShowCustomFields. Has anyone
tried to do this? I can see the callback provides a Name (reference to
a string), the CustomField object and an Object (which I think will be
a Ticket object). I imagine I need to massage what
$Object->CustomFieldValues($CF_id) returns, but I’m not exactly sure
how to go about it. Alternately, I could create a new
Elements/ShowCustomField$type component and massage the Name to be the
new component.

Has anyone done this sort of thing and/or can provide an example?

Thanks,
Drew
Drew Taylor * Web development & consulting
Email: drew@drewtaylor.com * Site implementation & hosting
Web : www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres

Drew,

This thread may provide the inspiration you need.
http://lists.bestpractical.com/pipermail/rt-users/2008-February/050042.html

-ToddOn Wed, Oct 15, 2008 at 9:05 PM, Drew Taylor taylor.andrew.j@gmail.comwrote:

Hi all,

I was originally wanting to add new CustomField types to enable things
like showing a flag for “Country” in addition to the text. But I just
realized I think I can do w/o a new type by using the
ShowComponentName Callback in Elements/ShowCustomFields. Has anyone
tried to do this? I can see the callback provides a Name (reference to
a string), the CustomField object and an Object (which I think will be
a Ticket object). I imagine I need to massage what
$Object->CustomFieldValues($CF_id) returns, but I’m not exactly sure
how to go about it. Alternately, I could create a new
Elements/ShowCustomField$type component and massage the Name to be the
new component.

Has anyone done this sort of thing and/or can provide an example?

Thanks,
Drew


Drew Taylor * Web development & consulting
Email: drew@drewtaylor.com * Site implementation & hosting
Web : www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres


List info:
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel

While it’s possible to do that without a new field type, it’s a lot
cleaner if you create one anyway. For something like that you only
really need to register the field, and then create a Show and Edit
component for it. Doing it that way also keeps everything self
contained.

JonOn Thu, 2008-10-16 at 02:05 +0100, Drew Taylor wrote:

Hi all,

I was originally wanting to add new CustomField types to enable things
like showing a flag for “Country” in addition to the text. But I just
realized I think I can do w/o a new type by using the
ShowComponentName Callback in Elements/ShowCustomFields. Has anyone
tried to do this? I can see the callback provides a Name (reference to
a string), the CustomField object and an Object (which I think will be
a Ticket object). I imagine I need to massage what
$Object->CustomFieldValues($CF_id) returns, but I’m not exactly sure
how to go about it. Alternately, I could create a new
Elements/ShowCustomField$type component and massage the Name to be the
new component.

Has anyone done this sort of thing and/or can provide an example?

Thanks,
Drew
Jon Wood
SYSTEMS DEVELOPER

Claranet Limited
21 Southampton Row
London - WC1B 5HA
United Kingdom

+44 (0)20 7685 8643
jonathan.wood@uk.clara.net

Company registration no: 3152737
Place of registration: England

All the information contained within this this electronic message from
Claranet Ltd is covered by the disclaimer at