RT 5.0.6 Documentation

RT::Record::Role::LookupType

Go to latest version →

NAME

RT::Record::Role::LookupType - Common methods for records which have a LookupType

DESCRIPTION

Certain records, like custom fields, can be applied to different types of records (tickets, transactions, groups, users, etc). This role implements such LookupType concerns.

This role does not manage concerns relating to specifying which records of a class (as in RT::ObjectCustomField).

REQUIRES

RT::Record::Role

LookupType

A LookupType method which returns this record's lookup type is required. Currently unenforced at compile-time due to poor interactions with "AUTOLOAD" in DBIx::SearchBuilder::Record. You'll hit run-time errors if this method isn't available in consuming classes, however.

PROVIDES

RegisterLookupType LOOKUPTYPE OPTIONS

Tell RT that a certain object accepts records of this role via a lookup type. OPTIONS is a hash reference for which the following keys are used:

FriendlyName

The string to display in the UI to users for this lookup type

For backwards compatibility, OPTIONS may also be a string which is interpreted as specifying the FriendlyName.

Examples:

    'RT::Queue-RT::Ticket'                 => "Tickets",                # loc
    'RT::Queue-RT::Ticket-RT::Transaction' => "Ticket Transactions",    # loc
    'RT::User'                             => "Users",                  # loc
    'RT::Group'                            => "Groups",                 # loc
    'RT::Queue'                            => "Queues",                 # loc

This is a class method.

LookupTypes

Returns an array of LookupTypes available for this record or class

LookupTypeRegistration [PATH] [OPTION]

Returns the arguments of calls to "RegisterLookupType". With no arguments, returns a hash of hashes, where the first-level key is the path (corresponding with "CustomFieldLookupType" in RT::Record) and the second-level hash is the option names. If path and option are provided, it looks up in that nested hash structure to provide the desired information.

FriendlyLookupType

Returns a localized description of the LookupType of this record

RecordClassFromLookupType

Returns the type of Object referred to by ObjectCustomFields' ObjectId column. (The first part of the LookupType, e.g. the RT::Queue of RT::Queue-RT::Ticket-RT::Transaction)

Optionally takes a LookupType to use instead of using the value on the loaded record. In this case, the method may be called on the class instead of an object.

ObjectTypeFromLookupType

Returns the ObjectType for this record. (The last part of the LookupType, e.g. the RT::Transaction of RT::Queue-RT::Ticket-RT::Transaction)

Optionally takes a LookupType to use instead of using the value on the loaded record. In this case, the method may be called on the class instead of an object.

IsOnlyGlobal

Certain record types (users, groups) should only be added globally; codify that set here for reference.

← Back to index