次のような場合に使用:ユーザーが Salesforce Lightning レポートのメタデータ(データ構造や設定情報)を作成、生成、または検証する必要がある場合。 レポート、レポート作成、レポートメタデータ、.report-meta.xml ファイル、表形式レポート、集計レポート、マトリックス形式レポート、結合レポート、レポート列、レポートグループ化、レポートフィルター、レポートチャート、クロスフィルター、バケットフィールド(カスタムカテゴリ)、レポート数式、またはレポート期間フィルターなどの言葉がユーザーから出た場合に起動します。 また、「レポートを作成して」「レポートを生成して」「アカウント情報のレポートを作成して」「レポートにチャートを追加して」といった表現や、.report-meta.xml ファイルのデプロイ(配置)エラーが発生した場合にも使用します。 **使用しない場合:** - カスタムレポートタイプのメタデータ作成・編集(.reportType-meta.xml — そちらは platform-custom-report-type-generate を使用) - ダッシュボード作成 - リストビュー作成 - UI 上での既存レポート実行・表示 - SOQL クエリ(データベース検索言語)
Use this skill when users need to create, generate, or validate Salesforce Lightning Report metadata. Trigger when users mention reports, creating reports, report metadata, .report-meta.xml files, tabular reports, summary reports, matrix reports, joined reports, report columns, report groupings, report filters, report charts, cross-filters, bucket fields, report formulas, or report time frame filters. Also use when users say things like 'create a report', 'generate a report', 'build a report on Accounts', 'add a chart to my report', or when they encounter deployment errors for .report-meta.xml files. Do NOT trigger for: creating or modifying Custom Report Type metadata (.reportType-meta.xml — use platform-custom-report-type-generate), creating dashboards, creating list views, running or viewing existing reports in the UI, or SOQL queries.
Lightning Reports(レポート)は、Salesforce データの検索、グループ化、フィルター、表示方法を定義します。各レポートは、プロジェクトのソース ディレクトリ内の reports/<フォルダ名>/ に配置された単一の .report-meta.xml ファイルです(ソース ディレクトリの場所は、sfdx-project.json の packageDirectories[].path で確認できます)。
デプロイ失敗の主な原因 — レポート作成前に必ず確認:
<groupingsDown> または <groupingsAcross> に指定したフィールドは、<columns> に絶対に記載してはいけませんreferences/column-names.md を参照)org を使い、organization ではありません<column> 値は、単純な名前(INDUSTRY、TYPE)を使用します。ドット記法(ACCOUNT.INDUSTRY など)は使えません<criteriaItems> にカンマ区切り値を入れます(例:Technology,Financial Services)。複数の criteriaItems に分割しないでください| フォーマット | <groupingsDown> |
<groupingsAcross> |
<block> |
|---|---|---|---|
Tabular(表形式) |
不可 | 不可 | なし |
Summary(集計) |
1 個以上(最大 3 個) | 不可 | なし |
Matrix(マトリックス) |
1 個以上(最大 3 個) | 1 個以上(最大 3 個) | なし |
Joined(結合) |
トップレベル不可 | トップレベル不可 | 2~5 個必須 |
レポート メタデータは、生の API フィールド名ではなく、プラットフォーム レポート カラム名を使用します。get_metadata_type_sections または get_metadata_type_context MCP ツールを呼び出して、有効なカラム名を確認してください。references/column-names.md には、レポート タイプごとの一般的なマッピングが記載されています。
<reportType> には、標準の API 名(例:Opportunity、AccountList、CaseList、LeadList、AccountContactRole)または、デプロイ済みのカスタム レポート タイプの開発者名を指定します。
グラフと <aggregateTypes>(合計、平均など)は、集計形式またはマトリックス形式のレポートでのみ機能します。
<filterLogic> は、すべてのフィルターを順序立てて参照する必要があります(例:1 AND (2 OR 3))レポートは、対応するフォルダ メタデータ ファイルを持つフォルダの中に配置する必要があります:
<ソースディレクトリ>/reports/<フォルダ名>/<レポート名>.report-meta.xml
<ソースディレクトリ>/reports/<フォルダ名>-meta.xml
<ソースディレクトリ> は sfdx-project.json から判定します(通常は force-app/main/default、ただし設定可能です)。
CloseDate ではなく CLOSE_DATE)org。Opportunity・AccountList・CaseList は organization です<description> は最大 255 文字<columns> に記載してはいけません — デプロイ時に自動的に失敗します<sharedTo> が必須<?xml version="1.0" encoding="UTF-8"?>
<ReportFolder xmlns="http://soap.sforce.com/2006/04/metadata">
<folderShares>
<accessLevel>Manage</accessLevel>
<sharedTo>AllInternalUsers</sharedTo>
<sharedToType>Group</sharedToType>
</folderShares>
<name>レポート フォルダ名</name>
</ReportFolder>
INTERVAL_CURRENT(今四半期)、INTERVAL_CURY(今年度)、INTERVAL_LAST30(過去 30 日)を使用します。INTERVAL_CURQ は有効ではありません。完全なリストは references/date-intervals.md を参照してください。
| 要素 | 必須 | 説明 |
|---|---|---|
<name> |
はい | レポート名(最大 40 文字) |
<reportType> |
はい | レポート タイプ API 名 |
<format> |
はい | Tabular、Summary、Matrix、Joined |
<scope> |
推奨 | organization(LeadList の場合は org) |
<columns> |
はい | フィールド カラム — 各カラムに <field> と、任意で <aggregateTypes> を含める |
<filter> |
いいえ | <criteriaItems>(<column>、<operator>、<value> を含む)を保持 |
<groupingsDown> |
条件付き | 行グループ化:<field>、<dateGranularity>、<sortOrder> |
<groupingsAcross> |
条件付き | 列グループ化(マトリックス形式のみ) |
<timeFrameFilter> |
推奨 | <dateColumn>、<interval>、任意で <startDate>/<endDate> |
<chart> |
いいえ | references/chart-types.md を参照 |
<buckets> |
いいえ | バケット フィールド定義 |
<crossFilters> |
いいえ | クロス オブジェクト フィルター(with/without) |
<showDetails> |
推奨 | true/false |
<showGrandTotal> |
推奨 | true/false |
<showSubTotals> |
推奨 | true/false |
<description> |
推奨 | ビジネス上の目的(最大 255 文字) |
<block> |
条件付き | 結合形式のブロック |
<filter>
<criteriaItems>
<column>STAGE_NAME</column>
<operator>equals</operator>
<value>Closed Won</value>
</criteriaItems>
</filter>
複数選択肢ピックリスト: 1 つの criteriaItem にカンマ区切り値を使用します:
<criteriaItems>
<column>INDUSTRY</column>
<operator>equals</operator>
<value>Technology,Financial Services</value>
</criteriaItems>
一般的な演算子:equals(等しい)、notEqual(等しくない)、lessThan(より小さい)、greaterThan(より大きい)、contains(を含む)、startsWith(で始まる)、includes(を含む)、excludes(を除外)、isBlank(空白)、notBlank(空白でない)。完全なリストは references/filter-operations.md を参照してください。
get_metadata_type_sections MCP ツールを呼び出して、レポート タイプの有効なプラットフォーム カラム名を取得examples/ の最も近い例から始めて調整<folderShares> を含む <フォルダ名>-meta.xml を生成references/verification-checklist.md を参照して実行| ファイル | 参照する場面 |
|---|---|
references/column-names.md |
ステップ 3 — レポート タイプごとのカラム名マッピング |
references/date-intervals.md |
timeFrameFilter の間隔を設定する場合 |
references/chart-types.md |
グラフを追加する場合 — 全 17 種類と凡例位置ルール |
references/filter-operations.md |
フィルターを作成する場合 — 完全な演算子リファレンス |
references/verification-checklist.md |
ステップ 6 — デプロイ前の検証 |
references/errors-and-troubleshooting.md |
フィールドが不足している場合またはデプロイ失敗時 |
examples/TabularOpportunitiesReport.report-meta.xml |
表形式レポート テンプレート |
examples/OpportunitiesByStageReport.report-meta.xml |
グラフ付き集計形式レポート |
examples/OpportunitiesByStageAndQuarter.report-meta.xml |
マトリックス形式レポート テンプレート |
examples/AccountsCreatedThisYear.report-meta.xml |
フィルター付き期間指定レポート |
Lightning Reports define how Salesforce data is queried, grouped, filtered, and displayed. Each report is a single .report-meta.xml file placed under reports/<FolderName>/ within the project's source directory (check sfdx-project.json → packageDirectories[].path for the source root).
TOP DEPLOYMENT KILLERS — check these BEFORE generating any report:
<groupingsDown> or <groupingsAcross> must NEVER also appear in <columns>references/column-names.md)org, not organization<column> values use FLAT names (INDUSTRY, TYPE) NOT dot notation (ACCOUNT.INDUSTRY is INVALID)<criteriaItems> with comma-separated <value> (e.g., Technology,Financial Services). Do NOT split into multiple criteriaItems with booleanFilter| Format | <groupingsDown> |
<groupingsAcross> |
<block> |
|---|---|---|---|
Tabular |
Not allowed | Not allowed | No |
Summary |
At least 1 (max 3) | Not allowed | No |
Matrix |
At least 1 (max 3) | At least 1 (max 3) | No |
Joined |
Not at top level | Not at top level | At least 2 (max 5) |
Report metadata uses platform report column names, NOT raw API field names. ALWAYS call get_metadata_type_sections or get_metadata_type_context to confirm valid column names. See references/column-names.md for common mappings per report type.
<reportType> must be a standard API name (e.g., Opportunity, AccountList, CaseList, LeadList, AccountContactRole) or a deployed custom report type developer name.
Charts and <aggregateTypes> (Sum, Average, etc.) only work in Summary and Matrix reports.
<filterLogic> must reference all filters sequentially (e.g., 1 AND (2 OR 3))Reports must live inside a folder with a corresponding folder metadata file:
<sourceDir>/reports/<FolderName>/<ReportName>.report-meta.xml
<sourceDir>/reports/<FolderName>-meta.xml
Determine <sourceDir> from sfdx-project.json (commonly force-app/main/default, but this is configurable).
CLOSE_DATE, not CloseDate)org; Opportunity/AccountList/CaseList use organization<description> max 255 characters<columns> — automatic deployment failure<sharedTo><?xml version="1.0" encoding="UTF-8"?>
<ReportFolder xmlns="http://soap.sforce.com/2006/04/metadata">
<folderShares>
<accessLevel>Manage</accessLevel>
<sharedTo>AllInternalUsers</sharedTo>
<sharedToType>Group</sharedToType>
</folderShares>
<name>My Report Folder</name>
</ReportFolder>
Use INTERVAL_CURRENT for "this quarter", INTERVAL_CURY for "this year", INTERVAL_LAST30 for last 30 days. Do NOT use INTERVAL_CURQ — it is not valid. See references/date-intervals.md for the full list.
| Element | Required | Notes |
|---|---|---|
<name> |
Yes | Report name (max 40 chars) |
<reportType> |
Yes | Report type API name |
<format> |
Yes | Tabular, Summary, Matrix, or Joined |
<scope> |
Recommended | organization (or org for LeadList) |
<columns> |
Yes | Field columns — each has <field> and optional <aggregateTypes> |
<filter> |
No | Contains <criteriaItems> with <column>, <operator>, <value> |
<groupingsDown> |
Conditional | Row groupings: <field>, <dateGranularity>, <sortOrder> |
<groupingsAcross> |
Conditional | Column groupings (Matrix only) |
<timeFrameFilter> |
Recommended | <dateColumn>, <interval>, optional <startDate>/<endDate> |
<chart> |
No | See references/chart-types.md |
<buckets> |
No | Bucket field definitions |
<crossFilters> |
No | Cross-object filters (with/without) |
<showDetails> |
Recommended | true/false |
<showGrandTotal> |
Recommended | true/false |
<showSubTotals> |
Recommended | true/false |
<description> |
Recommended | Business purpose (max 255 chars) |
<block> |
Conditional | Joined format blocks |
<filter>
<criteriaItems>
<column>STAGE_NAME</column>
<operator>equals</operator>
<value>Closed Won</value>
</criteriaItems>
</filter>
Multi-value picklist: Use ONE criteriaItem with comma-separated values:
<criteriaItems>
<column>INDUSTRY</column>
<operator>equals</operator>
<value>Technology,Financial Services</value>
</criteriaItems>
Common operators: equals, notEqual, lessThan, greaterThan, contains, startsWith, includes, excludes, isBlank, notBlank. Full list in references/filter-operations.md.
get_metadata_type_sections MCP tool to get valid platform column names for the report typeexamples/ and adapt<FolderName>-meta.xml with <folderShares>references/verification-checklist.md| File | When to read |
|---|---|
references/column-names.md |
Step 3 — column name mappings per report type |
references/date-intervals.md |
When setting timeFrameFilter intervals |
references/chart-types.md |
When adding a chart — all 17 types + legendPosition rules |
references/filter-operations.md |
When building filters — complete operator reference |
references/verification-checklist.md |
Step 6 — pre-deploy validation |
references/errors-and-troubleshooting.md |
When fields are missing or deployment fails |
examples/TabularOpportunitiesReport.report-meta.xml |
Tabular report template |
examples/OpportunitiesByStageReport.report-meta.xml |
Summary report with chart |
examples/OpportunitiesByStageAndQuarter.report-meta.xml |
Matrix report template |
examples/AccountsCreatedThisYear.report-meta.xml |
Filtered report with time frame |
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。