ReportMetadata Class

Contains report metadata for a tabular, summary, or matrix report.

Namespace

Reports

Usage

Report metadata gives information about the report as a whole, such as the report type, format, summary fields, row or column groupings, and filters that are saved to the report. You can use the ReportMetadata class to retrieve report metadata and to set metadata that can be used to filter a report.

ReportMetadata Methods

The following are methods for ReportMetadata. All are instance methods.

getAggregates()

Returns unique identifiers for summary or custom summary formula fields in the report.

Syntax

public LIST<String> getAggregates()

Return Value

Type: List<String>

Usage

For example:

  • a!Amount represents the average for the Amount column.
  • s!Amount represents the sum of the Amount column.
  • m!Amount represents the minimum value of the Amount column.
  • x!Amount represents the maximum value of the Amount column.
  • s!<customfieldID> represents the sum of a custom field column. For custom fields and custom report types, the identifier is a combination of the summary type and the field ID.

getBuckets()

Returns a list of bucket fields in the report.

Signature

public List<Reports.BucketField> getBuckets()

Return Value

Type: List<Reports.BucketField>

getCrossFilters()

Returns information about cross filters applied to a report.

Signature

public Reports.CrossFilter getCrossFilters()

Return Value

Type: List<Reports.CrossFilter>

getCurrencyCode()

Returns report currency, such as USD, EUR, or GBP, for an organization that has multicurrency enabled. The value is null if the organization does not have multicurrency enabled.

Syntax

public String getCurrencyCode()

Return Value

Type: String

getCustomSummaryFormula()

Returns information about custom summary formulas in a report.

Signature

public Map<String,Reports.ReportCsf> getCustomSummaryFormula()

Return Value

Type: Map<String,Reports.ReportCsf>

getDescription()

Returns the description of the report.

Signature

public String getDescription()

Return Value

Type: String

getDetailColumns()

Returns unique API names (column names) for the fields that contain detailed data. For example, the method might return the following values: “OPPORTUNITY_NAME, TYPE, LEAD_SOURCE, AMOUNT.”

Syntax

public LIST<String> getDetailColumns()

Return Value

Type: List<String>

getDeveloperName()

Returns the report API name. For example, the method might return the following value: “Closed_Sales_This_Quarter.”

Syntax

public String getDeveloperName()

Return Value

Type: String

getDivision()

Returns the division specified in the report.

Signature

Note

Note

Reports that use standard filters (such as My Cases or My Team’s Accounts) show records in all divisions. These reports can’t be further limited to a specific division.

public String getDivision()

Return Value

Type: String

getGroupingsAcross()

Returns column groupings in a report.

Syntax

public LIST<Reports.GroupingInfo> getGroupingsAcross()

Return Value

Type: List<Reports.GroupingInfo>

Usage

The identifier is:

  • An empty array for reports in summary format, because summary reports don't include column groupings
  • BucketField_(ID) for bucket fields
  • The ID of a custom field when the custom field is used for a column grouping

getGroupingsDown()

Returns row groupings for a report.

Syntax

public LIST<Reports.GroupingInfo> getGroupingsDown()

Return Value

Type: List<Reports.GroupingInfo>

Usage

The identifier is:

  • BucketField_(ID) for bucket fields
  • The ID of a custom field when the custom field is used for grouping

getHasDetailRows()

Indicates whether the report has detail rows.

Signature

public Boolean getHasDetailRows()

Return Value

Type: Boolean

getHasRecordCount()

Indicates whether the report shows the total number of records.

Signature

public Boolean getHasRecordCount()

Return Value

Type: Boolean

getHistoricalSnapshotDates()

Returns a list of historical snapshot dates.

Syntax

public LIST<String> getHistoricalSnapshotDates()

Return Value

Type: List<String>

getId()

Returns the unique report ID.

Syntax

public Id getId()

Return Value

Type: Id

getName()

Returns the report name.

Syntax

public String getName()

Return Value

Type: String

getReportBooleanFilter()

Returns logic to parse custom field filters. The value is null when filter logic is not specified.

Syntax

public String getReportBooleanFilter()

Return Value

Type: String

getReportFilters()

Returns a list of each custom filter in the report along with the field name, filter operator, and filter value.

Syntax

public LIST<Reports.ReportFilter> getReportFilters()

Return Value

Type: List<Reports.ReportFilter>

getReportFormat()

Returns the format of the report.

Syntax

public Reports.ReportFormat getReportFormat()

Return Value

Type: Reports.ReportFormat

Usage

This value can be:

  • TABULAR
  • SUMMARY
  • MATRIX

getReportType()

Returns the unique API name and display name for the report type.

Syntax

public Reports.ReportType getReportType()

Return Value

Type: Reports.ReportType

getScope()

Returns the API name for the scope defined for the report. Scope values depend on the report type.

Signature

public String getScope()

Return Value

Type: String

getShowGrandTotal()

Indicates whether the report shows the grand total.

Signature

public Boolean getShowGrandTotal()

Return Value

Type: Boolean

getShowSubtotals()

Indicates whether the report shows subtotals, such as column or row totals.

Signature

public Boolean getShowSubtotals()

Return Value

Type: Boolean

getSortBy()

Returns the list of columns on which the report is sorted. Currently, you can sort on only one column.

Signature

public List<Reports.SortColumn> getSortBy()

Return Value

Type: List<Reports.SortColumn>

getStandardDateFilter()

Returns information about the standard date filter for the report, such as the start date, end date, date range, and date field API name.

Signature

public Reports.StandardDateFilter getStandardDateFilter()

Return Value

Type: Reports.StandardDateFilter

getStandardFilters()

Returns a list of standard filters for the report.

Signature

public List<Reports.StandardFilter> getStandardFilters()

Return Value

Type: List<Reports.StandardFilter>

getTopRows()

Returns information about a row limit filter, including the number of rows returned and the sort order.

Signature

public Reports.TopRows getTopRows()

Return Value

Type: Reports.TopRows

setAggregates(aggregates)

Sets unique identifiers for standard or custom summary formula fields in the report.

Signature

public void setAggregates(List<String> aggregates)

Parameters

aggregates
Type: List<String>

Return Value

Type: void

setBuckets(buckets)

Creates bucket fields in a report.

Signature

public void setBuckets(List<Reports.BucketField> buckets)

Parameters

buckets
Type: List<Reports.BucketField>

Return Value

Type: void

setCrossFilters(crossFilters)

Applies cross filters to a report.

Signature

public void setCrossFilters(List<Reports.CrossFilter> crossFilters)

Parameters

crossFilter
Type: List<Reports.CrossFilter>

Return Value

Type: void

setCurrencyCode(currencyCode)

Sets the currency, such as USD, EUR, or GBP, for report summary fields in an organization that has multicurrency enabled.

Signature

public void setCurrencyCode(String currencyCode)

Parameters

currencyCode
Type: String

Return Value

Type: void

setCustomSummaryFormula(customSummaryFormula)

Adds a custom summary formula to a report.

Signature

public void setCustomSummaryFormula(MAP<String,Reports.ReportCsf> customSummaryFormula)

Parameters

customSummaryFormula
Type: Map<String, Reports.ReportCsf>

Return Value

Type: void

setDescription(description)

Sets the description of the report.

Signature

public void setDescription(String description)

Parameters

description
Type: String

Return Value

Type: void

setDetailColumns(detailColumns)

Sets the unique API names for the fields that contain detailed data—for example, OPPORTUNITY_NAME, TYPE, LEAD_SOURCE, or AMOUNT.

Signature

public void setDetailColumns(List<String> detailColumns)

Parameters

detailColumns
Type: List<String>

Return Value

Type: void

setDeveloperName(developerName)

Sets the report API name—for example, Closed_Sales_This_Quarter.

Signature

public void setDeveloperName(String developerName)

Parameters

developerName
Type: String

Return Value

Type: void

setDivision(division)

Sets the division of the report.

Signature

Note

Note

Reports that use standard filters (such as My Cases or My Team’s Accounts) show records in all divisions. These reports can’t be further limited to a specific division.

public void setDivision(String division)

Parameters

division
Type: String

Return Value

Type: void

setGroupingsAcross(groupingInfo)

Sets column groupings in a report.

Signature

public void setGroupingsAcross(List<Reports.GroupingInfo> groupingInfo)

Parameters

groupingInfo
Type: List<Reports.GroupingInfo>

Return Value

Type: void

setGroupingsDown(groupingInfo)

Sets row groupings for a report.

Signature

public void setGroupingsDown(List<Reports.GroupingInfo> groupingInfo)

Parameters

groupingInfo
Type: List<Reports.GroupingInfo>

Return Value

Type: void

setHasDetailRows(hasDetailRows)

Specifies whether the report has detail rows.

Signature

public void setHasDetailRows(Boolean hasDetailRows)

Parameters

hasDetailRows
Type: Boolean

Return Value

Type: void

setHasRecordCount(hasRecordCount)

Specifies whether the report is configured to show the total number of records.

Signature

public void setHasRecordCount(Boolean hasRecordCount)

Parameters

hasRecordCount
Type: Boolean

Return Value

Type: void

setHistoricalSnapshotDates(historicalSnapshot)

Sets a list of historical snapshot dates.

Syntax

public Void setHistoricalSnapshotDates(LIST<String> historicalSnapshot)

Parameters

historicalSnapshot
Type: List<String>

Return Value

Type: Void

setId(id)

Sets the unique report ID.

Signature

public void setId(Id id)

Parameters

id
Type: Id

Return Value

Type: void

setName(name)

Sets the report name.

Signature

public void setName(String name)

Parameters

name
Type: String

Return Value

Type: void

setReportBooleanFilter(reportBooleanFilter)

Sets logic to parse custom field filters.

Syntax

public Void setReportBooleanFilter(String reportBooleanFilter)

Parameters

reportBooleanFilter
Type: String

Return Value

Type: Void

setReportFilters(reportFilters)

Sets a list of each custom filter in the report along with the field name, filter operator, and filter value.

Syntax

public Void setReportFilters(LIST<Reports.ReportFilter> reportFilters)

Parameters

reportFilters
Type: List<Reports.ReportFilter>

Return Value

Type: Void

setReportFormat(format)

Sets the format of the report.

Signature

public void setReportFormat(Reports.ReportFormat format)

Parameters

format
Type: Reports.ReportFormat

Return Value

Type: void

setReportType(reportType)

Sets the unique API name and display name for the report type.

Signature

public void setReportType(Reports.ReportType reportType)

Parameters

reportType
Type: Reports.ReportType

Return Value

Type: void

setScope(scopeName)

Sets the API name for the scope defined for the report. Scope values depend on the report type.

Signature

public void setScope(String scopeName)

Parameters

scopeName
Type: String

Return Value

Type: void

setShowGrandTotal(showGrandTotal)

Specifies whether the report shows the grand total.

Signature

public void setShowGrandTotal(Boolean showGrandTotal)

Parameters

showGrandTotal
Type: Boolean

Return Value

Type: void

setShowSubtotals(showSubtotals)

Specifies whether the report shows subtotals, such as column or row totals.

Signature

public void setShowSubtotals(Boolean showSubtotals)

Parameters

showSubtotals
Type: Boolean

Return Value

Type: void

setSortBy(column)

Sets the list of columns on which the report is sorted. Currently, you can only sort on one column.

Signature

public void setSortBy(List<Reports.SortColumn> column)

Parameters

column
Type: List<Reports.SortColumn>

Return Value

Type: void

setStandardDateFilter(dateFilter)

Sets the standard date filter—which includes the start date, end date, date range, and date field API name—for the report.

Signature

public void setStandardDateFilter(Reports.StandardDateFilter dateFilter)

Parameters

dateFilter
Type: Reports.StandardDateFilter

Return Value

Type: void

setStandardFilters(filters)

Sets one or more standard filters on the report.

Signature

public void setStandardFilters(List<Reports.StandardFilter> filters)

Parameters

filters
Type: List<Reports.StandardFilter>

Return Value

Type: void

setTopRows(topRows)

Applies a row limit filter to a report.

Signature

public Reports.TopRows setTopRows(Reports.TopRows topRows)

Parameters

topRows
Type: Reports.TopRows

Return Value

Type: void