---
schema_version: "1"
id: 92c24e02090210ebe76bb7d643a3eed2f25762c165ab7c3739fa2452416cc3bf
title: RelatedListItem Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_Metadata_RelatedListItem.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 50ddeb370cc679973f08651391b526fd40a62cfab6ec666e900dc4913f6b6d64
description: Represents an item in the related list in a page layout.A list of custom buttons used in the related list.A list of excluded related-list buttons.A list of fields displayed in the related list. Uses aliases instead of field or API names.A list of quick actions used on the related list.The name of the related list.The name of the field used for sorting.When sortField is set, the sortOrder property determines the sort order.Makes a duplicate copy of the Metadata.RelatedListItem.
---
# RelatedListItem Class

Represents an item in the related list in a page layout.

## Namespace

[Metadata](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Metadata.htm "The Metadata namespace provides classes and methods for working with custom metadata in Salesforce")

## Usage

Use this class when accessing [Metadata.Layout](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_Layout.htm#apex_class_Metadata_Layout "Represents the metadata associated with a page layout.") metadata components. For more information, see “RelatedListItem” in the [Metadata API Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/meta_intro.htm).

- **[RelatedListItem Properties](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_properties)**
- **[RelatedListItem Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_methods)**

## RelatedListItem Properties

The following are properties for RelatedListItem.

- **[customButtons](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_customButtons)**  
    A list of custom buttons used in the related list.
- **[excludeButtons](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_excludeButtons)**  
    A list of excluded related-list buttons.
- **[fields](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_fields)**  
    A list of fields displayed in the related list. Uses aliases instead of field or API names.
- **[quickActions](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_quickActions)**  
    A list of quick actions used on the related list.
- **[relatedList](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_relatedList)**  
    The name of the related list.
- **[sortField](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_sortField)**  
    The name of the field used for sorting.
- **[sortOrder](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_sortOrder)**  
    When sortField is set, the sortOrder property determines the sort order.

### customButtons

A list of custom buttons used in the related list.

#### Signature

public List<String\> customButtons {get; set;}

#### Property Value

Type: [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list "Contains methods for the List collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")\>

For more information, see “Define Custom Buttons and Links” in the Salesforce online help.

### excludeButtons

A list of excluded related-list buttons.

#### Signature

public List<String\> excludeButtons {get; set;}

#### Property Value

Type: [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list "Contains methods for the List collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")\>

### fields

A list of fields displayed in the related list. Uses aliases instead of field or API names.

#### Signature

public List<String\> fields {get; set;}

#### Property Value

Type: [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list "Contains methods for the List collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")\>

### quickActions

A list of quick actions used on the related list.

#### Signature

public List<String> quickActions {get; set;}

#### Property Value

Type: [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list "Contains methods for the List collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")\>

### relatedList

The name of the related list.

#### Signature

public String relatedList {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### sortField

The name of the field used for sorting.

#### Signature

public String sortField {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### sortOrder

When sortField is set, the sortOrder property determines the sort order.

#### Signature

public Metadata.SortOrder sortOrder {get; set;}

#### Property Value

Type: [Metadata.SortOrder](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_Metadata_SortOrder.htm#apex_enum_Metadata_SortOrder "Describes the sort order of a related list.")

## RelatedListItem Methods

The following are methods for RelatedListItem.

- **[clone()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Metadata_RelatedListItem.htm#apex_Metadata_RelatedListItem_clone)**  
    Makes a duplicate copy of the Metadata.RelatedListItem.

### clone()

Makes a duplicate copy of the Metadata.RelatedListItem.

#### Signature

public Object clone()

#### Return Value

Type: Object