ReportType

Represents the metadata associated with a custom report type. Custom report types allow you to build a framework from which users can create and customize reports.

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Important

Redeploying a report type with the same fullName as a previously deleted report type via Metadata API restores the deleted report type instead of creating a new one, even if the report type was removed from the Recycle Bin. The restored report type keeps its original Id, CreatedDate, and CreatedById.

Parent Type 

This type extends Metadata and inherits its fields.

File Suffix and Directory Location 

The file suffix is .reportType for the custom report type definition. There’s one file per custom report type. Report types are stored in the reportTypes directory of the corresponding package directory.

Version 

Custom report types are available in API version 14.0 and later.

Fields 

autogenerated 

  • Type: boolean
  • Required: No
  • Introduced: API version 29.0
  • Description: Indicates that the report type was automatically generated when historical trending was enabled for an entity.

baseObject 

  • Type: string

  • Required: Yes

  • Description: Required. The primary object for the custom report type, for example, Account. All objects, including custom and external objects, are supported. You can’t edit this field after initial creation.

    Support for external objects is available in API version 38.0 and later.

category 

  • Type: ReportTypeCategory (enumeration of type string)
  • Required: No
  • Description: This field controls the category for the report.
  • Possible values:
    • accounts
    • opportunities
    • forecasts
    • cases
    • leads
    • campaigns
    • activities
    • busop
    • products
    • admin
    • territory
    • territory2 — (This value is available in API version 31.0 and later.)
    • usage_entitlement
    • wdc — (This value is available in API version 29.0 and later.)
    • calibration — (This value is available in API version 29.0 and later.)
    • other
    • content
    • quotes
    • individual — (This value is available in API version 45.0 and later.)
    • employee — (This value is available in API version 46.0 and later.)
    • data_cloud — (This value is available in API version 55.0 and later.)
    • commerce — (This value is available in API version 60.0 and later.)
    • flow — (This value is available in API version 60.0 and later.)
    • semantic_model — (This value is available in API version 60.0 and later.)

deployed 

  • Type: boolean
  • Required: Yes
  • Description: Required. Indicates whether the report type is available to users (true) or whether it’s still in development (false).

description 

  • Type: string
  • Required: No
  • Description: The description of the custom report type.

fullName 

  • Type: string
  • Required: No
  • Description: The report type developer name used as a unique identifier for API access. The fullName can contain only underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.

join 

  • Type: ObjectRelationship
  • Required: No
  • Description: The object joined to the baseObject. For example, Contacts can be joined to the primary Accounts object.

label 

  • Type: string
  • Required: Yes
  • Description: Required. The report type label.

sections 

  • Type: ReportLayoutSection[]
  • Required: No
  • Description: The groups of columns available for the report type. Though columns aren’t strictly required, a report without columns isn’t useful.

ObjectRelationship Type 

ObjectRelationship represents a join to another object.

Fields 

join 

  • Type: ObjectRelationship
  • Required: No
  • Description: This field is a recursive reference that allows you to join more than two objects. A maximum of four objects can be joined in a custom report type. When more than two objects are joined, an inner join isn’t allowed if there has been an outer join earlier in the join sequence. The baseObject is first joined to the object specified in relationship; the resulting dataset is then joined with any objects specified in this field.

outerJoin 

  • Type: boolean
  • Required: Yes
  • Description: Required. Indicates whether it’s an outer join (true) or not (false). An outer join returns a row even if the joined table doesn’t contain a matching value in the join column.

relationship 

  • Type: string
  • Required: Yes
  • Description: Required. The object joined to the primary object; for example, Contacts.

ReportLayoutSection Type 

ReportLayoutSection represents a group of columns used in the custom report type.

Fields 

columns 

  • Type: ReportTypeColumn[]
  • Required: No
  • Description: The list of columns projected from the query, defined by this custom report type.

masterLabel 

  • Type: string
  • Required: Yes
  • Description: Required. The label for this group of columns in the report wizard.

ReportTypeColumn Type 

ReportTypeColumn represents a column in the custom report type.

Fields 

checkedByDefault 

  • Type: boolean
  • Required: Yes
  • Description: Required. Indicates whether this column is selected by default (true) or not (false).

displayNameOverride 

  • Type: string
  • Required: No
  • Description: A customized column name, if desired.

field 

  • Type: string
  • Required: Yes
  • Description: Required. The field name associated with the report column.

table 

  • Type: string
  • Required: Yes
  • Description: Required. The table associated with the field; for example, Account.

Declarative Metadata Sample Definition 

The definition of a custom report type is shown in this example. Account is joined to Contacts and the resulting dataset is joined with Assets.

1<?xml version="1.0" encoding="UTF-8"?>
2<ReportType xmlns="http://soap.sforce.com/2006/04/metadata">
3    <baseObject>Account</baseObject>
4    <category>accounts</category>
5    <deployed>true</deployed>
6    <description>Account linked to Contacts and Assets</description>
7    <join>
8        <join>
9            <outerJoin>false</outerJoin>
10            <relationship>Assets</relationship>
11        </join>
12        <outerJoin>false</outerJoin>
13        <relationship>Contacts</relationship>
14    </join>
15    <label>Account Contacts and Assets</label>
16    <sections>
17        <columns>
18            <checkedByDefault>true</checkedByDefault>
19            <field>obj_lookup__c.Id</field>
20            <table>Account</table>
21        </columns>
22        <columns>
23            <checkedByDefault>false</checkedByDefault>
24            <field>obj_lookup__c.Name</field>
25            <table>Account</table>
26        </columns>
27        <columns>
28            <checkedByDefault>false</checkedByDefault>
29            <field>Opportunity__c.Amount</field>
30            <table>Account</table>
31        </columns>
32        <columns>
33            <checkedByDefault>false</checkedByDefault>
34            <field>Owner.IsActive</field>
35            <table>Account</table>
36        </columns>
37        <masterLabel>Accounts</masterLabel>
38    </sections>
39    <sections>
40        <columns>
41            <checkedByDefault>false</checkedByDefault>
42            <field>Owner.Email</field>
43            <table>Account.Contacts</table>
44        </columns>
45        <columns>
46            <checkedByDefault>false</checkedByDefault>
47            <field>byr__c</field>
48            <table>Account.Contacts</table>
49        </columns>
50        <columns>
51            <checkedByDefault>true</checkedByDefault>
52            <field>ReportsTo.CreatedBy.Contact.Owner.MobilePhone</field>
53            <table>Account.Contacts</table>
54        </columns>
55        <masterLabel>Contacts</masterLabel>
56    </sections>
57</ReportType>

Usage 

The custom report type refers to fields by using their API names. For a historical field (one that has trackTrending set to true) the API name includes hst, such as Field2__c_hst.

1<sections>
2 <columns>
3 <checkedByDefault>false</checkedByDefault>
4 <field>Field2__c_hst</field>
5 <table>CustomTrendedObject__c.CustomTrendedObject__c_hst</table>
6 </columns>
7 <masterLabel>History</masterLabel>
8</sections>

For more information, see trackTrending.

Wildcard Support in the Manifest File 

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.