- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
  - LimitToGrouping
  - LimitToLookupType
  - LimitToChildType
  - LimitToParentType
  - LimitToObjectId
  - LimitToGlobalOrObjectId
  - LimitToNotAdded
  - LimitToAdded
  - LimitToGlobalOrQueue QUEUEID
  - LimitToQueue QUEUEID
  - LimitToGlobal
  - LimitToDefaultValuesSupportedTypes
  - ApplySortOrder
  - ContextObject
  - SetContextObject
  - AddRecord
  - NewItem
  - LimitToCatalog

# NAME

      RT::CustomFields - a collection of RT CustomField objects

# SYNOPSIS

      use RT::CustomFields;

# DESCRIPTION

# METHODS

## LimitToGrouping

Limits this collection object to custom fields which appear under a specified grouping by calling "Limit" for each CF name as appropriate.

Requires an RT::Record object or class name as the first argument and accepts a grouping name as the second. If the grouping name is false (usually via the empty string), limits to custom fields which appear in no grouping.

Caveat: While the record object or class name is used to find the available groupings, no automatic limit is placed on the lookup type of the custom fields. It's highly suggested you limit the collection by queue or another lookup type first. This is already done for you if you're creating the collection via the "CustomFields" method on an RT::Record object.

## LimitToLookupType

Takes LookupType and limits collection.

## LimitToChildType

Takes partial LookupType and limits collection to records where LookupType is equal or ends with the value.

## LimitToParentType

Takes partial LookupType and limits collection to records where LookupType is equal or starts with the value.

## LimitToObjectId

Takes an ObjectId and limits the collection to CFs applied to said object.

When called multiple times the ObjectId limits are joined with OR.

## LimitToGlobalOrObjectId

Takes list of object IDs and limits collection to custom fields that are added to these objects or globally.

## LimitToNotAdded

Takes either list of object ids or nothing. Limits collection to custom fields to listed objects or any corespondingly. Use zero to mean global.

## LimitToAdded

Limits collection to custom fields to listed objects or any corespondingly. Use zero to mean global.

## LimitToGlobalOrQueue QUEUEID

Limits the set of custom fields found to global custom fields or those tied to the queue `QUEUEID`, similar to "LimitToGlobalOrObjectId".

Note that this will cause the collection to only return ticket CFs.

## LimitToQueue QUEUEID

Takes a numeric `QUEUEID`, and limits the Custom Field collection to those only applied directly to it; this limit is OR'd with other "LimitToQueue" and "LimitToGlobal" limits.

Note that this will cause the collection to only return ticket CFs.

## LimitToGlobal

Limits the Custom Field collection to global ticket CFs; this limit is OR'd with "LimitToQueue" limits.

Note that this will cause the collection to only return ticket CFs.

## LimitToDefaultValuesSupportedTypes

Limits the Custom Field collection to ones of which types support default values.

## ApplySortOrder

Sort custom fields according to thier order application to objects. It's expected that collection contains only records of one "LookupType" in RT::CustomField and applied to one object or globally ("LimitToGlobalOrObjectId"), otherwise sorting makes no sense.

## ContextObject

Returns context object for this collection of custom fields, but only if it's defined.

## SetContextObject

Sets context object for this collection of custom fields.

## AddRecord

Overrides the collection to ensure that only custom fields the user can see are returned; also propagates down the "ContextObject".

## NewItem

Returns an empty new RT::CustomField item Overrides <RT::SearchBuilder/NewItem> to make sure </ContextObject> is inherited.

## LimitToCatalog

Takes a numeric RT::Catalog ID. Limits the RT::CustomFields collection to only those fields applied directly to the specified catalog. This limit is OR'd with other "LimitToCatalog" and "LimitToObjectId" in RT::CustomFields calls.

Note that this will cause the collection to only return asset CFs.

← Back to index