このスキルは、ユーザーが Salesforce のカスタムレポートタイプ(カスタマイズされたレポート形式の定義ファイル)に関するメタデータを作成、生成、または検証する必要がある場合に使用します。 **以下の場合に使用:** - ユーザーがカスタムレポートタイプ、レポートタイプ、CRT、レポート機能の枠組み、複数オブジェクト間のレポート、レポートビルダーのデータソースなどについて述べた場合 - ユーザーが関連するオブジェクト間でフィールドをレポートに表示させる方法を尋ねた場合 - ユーザーがレポートの主要オブジェクトや関連オブジェクト、レポート内の結合方式(内部結合・外部結合)、レポートタイプのカテゴリについて述べた場合 - .reportType-meta.xml ファイルのデプロイメント(配置)エラーが発生した場合 **使用してはいけない場合:** - 既存のレポートの実行、編集、またはフィルタリング - レポートフォルダ、ダッシュボード、またはリストビューの作成 - .reportType-meta.xml ファイルの作成に関わらない一般的なレポート関連の質問
Use this skill when users need to create, generate, or validate Salesforce Custom Report Type metadata. Trigger when users mention custom report types, report types, CRTs, reporting frameworks, cross-object reports, report builder data sources, or ask to expose fields for reporting across related objects. Also use when users mention primary and related objects for reports, inner vs outer joins in reports, report type categories, or encounter deployment errors for .reportType-meta.xml files. Do NOT trigger for: running, editing, or filtering existing reports; creating report folders, dashboards, or list views; or general reporting questions that don't involve authoring a .reportType-meta.xml file.
Custom Report Types (CRTs) define the data framework for Salesforce reports. They specify a primary object, up to 3 related objects, the relationship (join) between them, and which fields are available in the report builder.
File extension: .reportType-meta.xml. The file basename is the report type's developer name (e.g. AccountsWithProjects.reportType-meta.xml). Each CRT is a single file, not nested under an object folder.
Top-level <ReportType> children:
| Element | Required | Notes |
|---|---|---|
<fullName> |
Yes | API identifier; must match the file name. Letters, numbers, underscores; must begin with a letter; no spaces; no trailing underscore; no consecutive underscores |
<label> |
Yes | Human-friendly name shown in the report type picker |
<description> |
Recommended | State the business "why" — who uses this and what they learn |
<baseObject> |
Yes | API name of the primary object (e.g. Account, Project__c). Cannot be changed after initial creation. All objects, including custom and external, are supported (external objects from API 38.0+) |
<category> |
Recommended | Report builder category — see references/category-values.md |
<deployed> |
Yes | true to expose to users; false while building/iterating |
<join> |
Conditional | Adds a related object and its join behavior. Nest further <join> blocks for deeper relationships |
<sections> |
Recommended | Groups of columns available to the report type. Though not strictly required, a report without columns isn't useful |
<sections> (group of columns) sub-elements:
| Element | Required | Notes |
|---|---|---|
<masterLabel> |
Yes | Section heading shown in the report builder |
<columns> |
Conditional | One per field exposed in the section |
<columns> (single field) sub-elements:
| Element | Required | Notes |
|---|---|---|
<field> |
Yes | Field API name (or dotted lookup-traversal path) |
<table> |
Yes | The object the field belongs to — base object name or dotted relationship path |
<checkedByDefault> |
Yes | true if the column is selected by default in the report builder |
<displayNameOverride> |
No | Custom column label shown in the report builder, overriding the field's default label |
<fullName> Is Present, It Must Match the File NameIn source format, fullName is inherited from Metadata and derived from the file name, so the <fullName> element is technically optional. The repo convention is to include it. If you include <fullName>, its value must equal the file name (everything before .reportType-meta.xml) exactly — same characters, same casing, same underscores.
Wrong — file name and <fullName> differ:
account_projects.reportType-meta.xml<fullName>AccountProjects</fullName>
(Mismatch: file uses account_projects, fullName uses AccountProjects)Right — file name and <fullName> are identical:
AccountProjects.reportType-meta.xml<fullName>AccountProjects</fullName>outerJoin Controls InclusionEach <join> block has an <outerJoin> element that determines which primary records appear in the report:
<outerJoin> value |
Behavior | Report Builder Label |
|---|---|---|
false |
Inner join — only primary records that HAVE at least one related record | "Each 'A' record must have at least one related 'B' record" |
true |
Outer join — all primary records, with or without related records | "'A' records may or may not have related 'B' records" |
Default when unspecified: Use true (outer join) when the user wants to see all primary records regardless of children. Use false when the report only makes sense if children exist.
<sections> BlockEvery object in the CRT (primary + each joined object) must have a corresponding <sections> block that lists the fields exposed for reporting. Without a section for an object, none of its fields appear in the report builder.
<masterLabel> on each section is the section heading in the report builder<columns> entries list the fields — each with a <field> (API name) and <table> (object API name)<field> (e.g. Owner.Name with <table> set to the owning object)Use exact API names for fields: standard fields use their defined names (Name, CreatedDate, OwnerId), custom fields use Field__c. Custom objects must include __c.
Wrong:
<field>Account Name</field>Right:
<field>Name</field> with <table>Account</table>When adding a <join>, the <relationship> element must use the child relationship name as defined on the lookup/master-detail field pointing from the child object to the parent. For custom relationships, this typically ends in __r.
Wrong:
<relationship>Project</relationship> (for a custom child relationship)Right:
<relationship>Projects__r</relationship> (child relationship name)<relationship>Contacts</relationship> (standard, non-custom child relationship)A single CRT can join a maximum of four objects total (the base object + up to 3 additional objects via nested <join> blocks).
Once the join chain contains an outer join (<outerJoin>true</outerJoin>), every subsequent nested join must also be an outer join. An inner join that follows an outer join earlier in the sequence is not allowed.
Wrong:
<join>
<outerJoin>true</outerJoin> <!-- outer join first -->
<relationship>Contacts</relationship>
<join>
<outerJoin>false</outerJoin> <!-- WRONG: inner join after outer -->
<relationship>Assets</relationship>
</join>
</join>
Right:
<join>
<outerJoin>true</outerJoin>
<relationship>Contacts</relationship>
<join>
<outerJoin>true</outerJoin> <!-- outer stays outer -->
<relationship>Assets</relationship>
</join>
</join>
<table> for Joined Objects Uses Dotted PathIn <sections>, the <table> element identifies which object in the join chain each column belongs to. For the base object, use the object name directly (e.g. Account). For joined objects, use the dotted relationship path from the base object.
| Object in chain | <table> value |
|---|---|
| Base (Account) | Account |
| First join (Account → Contacts) | Account.Contacts |
| Nested join (Account → Contacts → Assets) | Account.Contacts.Assets |
<field> values may reference fields reached via lookup relationships using dot notation — for example Owner.Email (owner User's email) or ReportsTo.CreatedBy.Contact.Owner.MobilePhone. The <table> must still be the object that owns the starting field.
_hst SuffixFor a field with trackTrending=true, the API name in <field> and <table> uses the _hst suffix:
<columns>
<checkedByDefault>false</checkedByDefault>
<field>Field2__c_hst</field>
<table>CustomTrendedObject__c.CustomTrendedObject__c_hst</table>
</columns>
Once deployed, the <baseObject> of a CRT is locked. To change the primary object, create a new CRT and retire the old one.
autogenerated Is Reserved for Historical TrendingThe <autogenerated> element (API 29.0+) marks CRTs that Salesforce created automatically when historical trending was enabled on an object. Do not set this manually on hand-authored CRTs.
Account, Project__c)deployed=true now or stays deployed=false during iterationDocument before authoring:
fullName and labelbaseObjectdeployed stateStart from the closest example in examples/ and adapt it to the user's scenario:
examples/AccountsWithIndustry.reportType-meta.xmlexamples/AccountsWithProjects.reportType-meta.xmlexamples/AccountProjectsWithTasks.reportType-meta.xmlName the file <DeveloperName>.reportType-meta.xml.
xmlns="http://soap.sforce.com/2006/04/metadata").reportType-meta.xml) matches <fullName> when <fullName> is included<baseObject> is a valid API name and the object is deployed<relationship> uses the correct child relationship name (__r suffix for custom)<sections> is part of the CRT (primary or joined)<field> references exist on the parent <table> and use API names (not labels)<category> is a valid Salesforce category value<deployed> is true if users need to access the CRT immediately| File | When to read |
|---|---|
examples/AccountsWithIndustry.reportType-meta.xml |
Step 2 / Step 4 — primary-object-only template |
examples/AccountsWithProjects.reportType-meta.xml |
Step 2 / Step 4 — outer-join template (primary included even without children) |
examples/AccountProjectsWithTasks.reportType-meta.xml |
Step 2 / Step 4 — nested inner-join template (every level requires children) |
references/category-values.md |
Step 3 — to choose a valid <category> value from the ReportTypeCategory enum |
references/errors-and-troubleshooting.md |
When fields don't appear in the report builder or join requirements conflict |
.reportType-meta.xml<fullName> is included, it matches the file basename exactly (same characters, casing, and underscores)<label> is human-readable and under 40 characters<description> explains the business purpose<baseObject> uses a valid API name and that object is deployed<category> is a valid ReportTypeCategory enum value<deployed> is set appropriately (true for user access, false for in-progress iteration)<autogenerated> is NOT set manually (reserved for historical-trending CRTs)<join> uses the correct child relationship name (not the lookup field API name)__r suffix<outerJoin> is set intentionally: true = optional children, false = required children<outerJoin>false</outerJoin>) appears after an outer join earlier in the sequence<sections> block<masterLabel> on each section is descriptive<columns> has both <field> (API name) and <table> (object API name or dotted path)<checkedByDefault> is set for each column<table> for base object is the object API name (e.g. Account)<table> for joined objects uses the dotted relationship path (e.g. Account.Projects__r, Account.Projects__r.Tasks__r)__cOwner.Email) with <table> set to the object owning the starting field_hst suffix in both <field> and <table> when applicable原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。