[rt-users] Fetching custom field id by a non-unique name

Maciej Dobrzanski reg.bestpractical at posterus.com
Thu Mar 22 20:27:48 EDT 2012


Hello,

I created two custom fields called "Customer ID" - one is for Ticket object,
while the other is for User. The name is not unique, but these are two
different CFs with different identifiers. In a callback I need to figure out
the appropriate field id depending on the context - whether a ticket or a
user details are being displayed. However the normal interface does not
really seem to allow that. In RT::CustomField, LoadByName() only takes field
name and optionally also queue name/id(?). The effect is that
LoadByName(Name => 'Customer ID') always loads the "first" CF it finds by
the name 'Customer ID', which does not necessarily mean the right one. Is
there any other way around it or do I really need to loop through all the
CFs as RT::CustomFields comes with LimitToLookupType(), which might allow
looping through RT::Queue-RT::Ticket or RT::User fields as needed.


Maciek




More information about the rt-users mailing list