Report

Saves changes to a report or deletes a report.

Resource URL 

DataURL
Summary/services/data/<latest API version>/analytics/reports/<report ID>

Formats 

JSON

HTTP Methods 

MethodDescription
PATCHSaves changes to a report. See this example.
DELETEDeletes a report. See this example.

PATCH Request Body 

PropertyTypeDescription
aggregatesArray of stringsUnique identities for summary or custom summary formula fields in the report.
allowedInCustomDetailFormulaBooleanSpecifies whether a field can be referenced in a row-level formula (true) or not (false).
bucketsBucket fieldDescribes a bucket field.
chartChart[]Details about the chart used in a report.
crossFiltersCross filter[]Cross filters applied to the report.
customDetailFormulaCustom Detail Formula[]An array of objects that describes row-level formulas.
customSummaryFormulaCustom summary formulaDescribes a custom summary formulas.
currencyStringReport currency, such as USD, EUR, GBP, for an organization that has Multi-Currency enabled. Value is null if the organization does not have Multi-Currency enabled.
dashboardSettingName/value pairAllows saving of dashboard settings to allow for reports with row limit filters on dashboards. Can be configured on a report for Top-N reports. The Name and Value fields in dashboardSetting are used as Grouping and Aggregate in dashboard components.
detailColumnsArray of stringsUnique API names for the fields that have detailed data.
developerNameStringReport API name.
divisionStringDetermines the division of records to include in the report. For example, West Coast and East Coast. Available only if your organization uses divisions to segment data and you have the “Affected by Divisions” permission. If you do not have the “Affected by Divisions” permission, your reports include records in all divisions.
folderIdStringID of the folder that contains the report. When the report is in the My Personal Custom Reports folder, folderId = userId. When the report is in the Unfiled Public Reports folder, folderId = orgId.
groupingsAcrossGroupings across[]Unique identities for each column grouping in a report. The identity is an empty array for reports in summary format as it can’t have column groupings, BucketField_(ID) for bucket fields, or the ID of a custom field when the custom field is used for a column grouping.
groupingsDownGroupings down[]Unique identities for each row grouping in a report. The identity is BucketField_(ID) for bucket fields, or the ID of a custom field when the custom field is used for grouping.
hasDetailRowsBooleanIndicates whether to include detailed data with the summary data.
hasRecordCountBooleanIndicates whether the report shows the record count.
historicalSnapshotDatesArray of stringsList of historical snapshot dates.
idStringUnique report ID.
nameStringDisplay name of the report.
presentationOptionsReport presentation optionsDisplay options in the Lightning Report Builder.
reportBooleanFilterStringLogic to parse custom field filters. Value is null when filter logic is not specified.
reportFiltersFilter details[]List of each custom filter in the report along with the field name, filter operator, and filter value.
reportFormatStringFormat of the report. Possible values are TABULAR, SUMMARY, MATRIX, or MULTI_BLOCK. The MULTI_BLOCK property is available in API version 43.0 and later.
reportTypeReport typeUnique API name and display name for the report type. type (string) is the unique identifier of the report type. label (string) is the display name of the report type.
scopeStringDefines the scope of the data on which you run the report. For example, you can run the report against all opportunities, opportunities you own, or opportunities your team owns. Valid values depend on the report type.
showGrandTotalBooleanIndicates whether the report shows the grand total.
showSubtotalsBooleanIndicates whether the report shows subtotals, such as column or row totals.
sortByArray of stringsAPI name of the field on which the report is sorted and the direction of the sort (asc or desc).
standardDateFilterArray of stringsStandard date filters available in reports. Each standard date filter contains the following properties: column (API name of the date field on which you filter the report data), durationValue (the range for which you want to run the report; the value is a date literal or ‘CUSTOM.’), startDate (start date), and endDate (end date).
standardFiltersArray of stringsList of filters that show up in the report by default. The filters vary by report type. For example, standard filters for reports on the Opportunity object are Show, Opportunity Status, and Probability. This list appears as name-value string pairs.
supportsRoleHierarchyBooleanIndicates whether the report type supports role hierarchy filtering (true) or not (false).
topRowsTop rowsDescribes a row limit filter applied to the report.
userOrHierarchyFilterIdStringUnique user or role ID of the user or role used by the report’s role hierarchy filter. If specified, a role hierarchy filter is applied to the report. If unspecified, no role hierarchy filter is applied to the report.

Example aggregates identities:

  • 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 identity is a combination of the summary type and the field ID.
  • u!{column_name} represents a unique count of values for the specified {column_name}. For example, u!_AccountName_ returns the number of unique account name values in the AccountName field.

Example reportBooleanFilter. This is an example of a report filtered to show opportunities for accounts that are either of customer or partner type OR their annual revenue exceeds 100K AND they are medium or large sized businesses. The filters are processed by the logic, “(1 OR 2) AND 3.”

1{
2...
3        "reportBooleanFilter": "(1 OR 2) AND 3",
4        "reportFilters": [
5            {
6                "value": "Analyst,Integrator,Press,Other",
7                "column": "TYPE",
8                "operator": "notEqual"
9            },
10            {
11                "value": "100,000",
12                "column": "SALES",
13                "operator": "greaterThan"
14            },
15            {
16                "value": "Small",
17                "column": "Size",
18                "operator": "notEqual"
19            }
20        ]
21    }
22}

Example sortBy:

1"sortBy":[{"sortColumn":"Account_ID","sortOrder":"asc"}]

PATCH Response Body 

PropertyTypeDescription
reportMetadataReport metadataUnique identifiers for groupings and summaries.
reportTypeMetadataReport type metadataFields in each section of a report type plus filter information for those fields.
reportExtendedMetadataReport extended metadataAdditional information about summaries and groupings.

Report metadata

PropertyTypeDescription
aggregatesArray of stringsUnique identities for summary or custom summary formula fields in the report.
allowedInCustomDetailFormulaBooleanSpecifies whether a field can be referenced in a row-level formula (true) or not (false).
bucketsBucket fieldDescribes a bucket field.
chartChart[]Details about the chart used in a report.
crossFiltersCross filter[]Cross filters applied to the report.
customDetailFormulaCustom Detail Formula[]An array of objects that describes row-level formulas.
customSummaryFormulaCustom summary formulaDescribes a custom summary formulas.
currencyStringReport currency, such as USD, EUR, GBP, for an organization that has Multi-Currency enabled. Value is null if the organization does not have Multi-Currency enabled.
dashboardSettingName/value pairAllows saving of dashboard settings to allow for reports with row limit filters on dashboards. Can be configured on a report for Top-N reports. The Name and Value fields in dashboardSetting are used as Grouping and Aggregate in dashboard components.
detailColumnsArray of stringsUnique API names for the fields that have detailed data.
developerNameStringReport API name.
divisionStringDetermines the division of records to include in the report. For example, West Coast and East Coast. Available only if your organization uses divisions to segment data and you have the “Affected by Divisions” permission. If you do not have the “Affected by Divisions” permission, your reports include records in all divisions.
folderIdStringID of the folder that contains the report. When the report is in the My Personal Custom Reports folder, folderId = userId. When the report is in the Unfiled Public Reports folder, folderId = orgId.
groupingsAcrossGroupings across[]Unique identities for each column grouping in a report. The identity is an empty array for reports in summary format as it can’t have column groupings, BucketField_(ID) for bucket fields, or the ID of a custom field when the custom field is used for a column grouping.
groupingsDownGroupings down[]Unique identities for each row grouping in a report. The identity is BucketField_(ID) for bucket fields, or the ID of a custom field when the custom field is used for grouping.
hasDetailRowsBooleanIndicates whether to include detailed data with the summary data.
hasRecordCountBooleanIndicates whether the report shows the record count.
historicalSnapshotDatesArray of stringsList of historical snapshot dates.
idStringUnique report ID.
nameStringDisplay name of the report.
presentationOptionsReport presentation optionsDisplay options in the Lightning Report Builder.
reportBooleanFilterStringLogic to parse custom field filters. Value is null when filter logic is not specified.
reportFiltersFilter details[]List of each custom filter in the report along with the field name, filter operator, and filter value.
reportFormatStringFormat of the report. Possible values are TABULAR, SUMMARY, MATRIX, or MULTI_BLOCK. The MULTI_BLOCK property is available in API version 43.0 and later.
reportTypeReport typeUnique API name and display name for the report type. type (string) is the unique identifier of the report type. label (string) is the display name of the report type.
scopeStringDefines the scope of the data on which you run the report. For example, you can run the report against all opportunities, opportunities you own, or opportunities your team owns. Valid values depend on the report type.
showGrandTotalBooleanIndicates whether the report shows the grand total.
showSubtotalsBooleanIndicates whether the report shows subtotals, such as column or row totals.
sortByArray of stringsAPI name of the field on which the report is sorted and the direction of the sort (asc or desc).
standardDateFilterArray of stringsStandard date filters available in reports. Each standard date filter contains the following properties: column (API name of the date field on which you filter the report data), durationValue (the range for which you want to run the report; the value is a date literal or ‘CUSTOM.’), startDate (start date), and endDate (end date).
standardFiltersArray of stringsList of filters that show up in the report by default. The filters vary by report type. For example, standard filters for reports on the Opportunity object are Show, Opportunity Status, and Probability. This list appears as name-value string pairs.
supportsRoleHierarchyBooleanIndicates whether the report type supports role hierarchy filtering (true) or not (false).
topRowsTop rowsDescribes a row limit filter applied to the report.
userOrHierarchyFilterIdStringUnique user or role ID of the user or role used by the report’s role hierarchy filter. If specified, a role hierarchy filter is applied to the report. If unspecified, no role hierarchy filter is applied to the report.

Example aggregates identities:

  • 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 identity is a combination of the summary type and the field ID.
  • u!{column_name} represents a unique count of values for the specified {column_name}. For example, u!_AccountName_ returns the number of unique account name values in the AccountName field.

Example reportBooleanFilter. This is an example of a report filtered to show opportunities for accounts that are either of customer or partner type OR their annual revenue exceeds 100K AND they are medium or large sized businesses. The filters are processed by the logic, “(1 OR 2) AND 3.”

1{
2...
3        "reportBooleanFilter": "(1 OR 2) AND 3",
4        "reportFilters": [
5            {
6                "value": "Analyst,Integrator,Press,Other",
7                "column": "TYPE",
8                "operator": "notEqual"
9            },
10            {
11                "value": "100,000",
12                "column": "SALES",
13                "operator": "greaterThan"
14            },
15            {
16                "value": "Small",
17                "column": "Size",
18                "operator": "notEqual"
19            }
20        ]
21    }
22}

Example sortBy:

1"sortBy":[{"sortColumn":"Account_ID","sortOrder":"asc"}]

Chart

PropertyTypeDescription
chartTypeStringType of chart.
groupingsStringReport grouping.
hasLegendBooleanIndicates whether the report has a legend.
showChartValuesBooleanIndicates whether the report shows chart values.
summariesArray of stringsUnique identities for summary or custom summary formula fields in the report.
summaryAxisLocationsStringSpecifies the axis that shows the summary values. Valid values are X and Y.
titleStringName of the chart.

Example summaries identities:

  • 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 identity is a combination of the summary type and the field ID.

Groupings down

PropertyTypeDescription
nameStringAPI name of the field used as a row grouping.
sortOrderStringOrder in which data is sorted within a row grouping. Value can be asc for ascending order or desc for descending order.
dateGranularityStringInterval set on a date field that’s used as a row grouping. Value can be Day, Calendar Week, Calendar Month, Calendar Quarter, Calendar Year, Fiscal Quarter, Fiscal Year, Calendar Month in Year, or Calendar Day in Month.
sortAggregateStringSummary field that’s used to sort data within a grouping in a report that’s in summary format. Applies if you have the Aggregate Sort feature enabled as part of its pilot program. The value is null when data within a grouping is not sorted by a summary field. In this example, data grouped by Account Owner is sorted by the sum of Annual Revenue.

Example sortAggregate:

1{
2    "aggregates": ["s!SALES","RowCount"],
3    "groupingsDown": [
4        {
5            "name": "USERS.NAME",
6            "sortOrder": "Desc",
7            "dateGranularity": "None",
8            "sortAggregate": "s!SALES"
9        }
10    ]
11}

Report presentation options

PropertyTypeDescription
hasStackedSummariesBooleanIndicates whether stacked summaries are enabled in the report.
historicalColumnsHistorical column presentation optionsPresentation options of the historical column.

Example historicalColumns presentation options:

1"presentationOptions" : {
2  "historicalColumns" : {
3    "Opportunity__hd.CloseDate__hst" : {
4      "decreaseIsPositive" : false,
5      "showChanges" : false
6    },
7    "Opportunity__hd.Amount__hst" : {
8      "decreaseIsPositive" : false,
9      "showChanges" : true
10    }
11  }
12}

Historical column presentation options

PropertyTypeDescription
decreaseIsPositiveBooleanIndicates whether a negative change (decrease in value) is displayed in green instead of red in Lightning Report Builder.
showChangesBooleanIndicates whether to display a change column for a given historical column.

Groupings across

PropertyTypeDescription
nameStringAPI name of the field used as a column grouping.
sortOrderStringOrder in which data is sorted within a column grouping. Value can be asc for ascending order or desc for descending order.
dateGranularityStringInterval set on a date field used as a column grouping. Value can be Day, Calendar Week, Calendar Month, Calendar Quarter, Calendar Year, Fiscal Quarter, Fiscal Year, Calendar Month in Year, or Calendar Day in Month.

Filter details

PropertyTypeDescription
columnStringUnique API name for the field that’s being filtered.
filterTypeStringDescribes the type of value used to filter report data. Valid values are fieldToField (filters report data by comparing values of one field with the values of a second field), fieldValue (filters report data by comparing values of a field with a defined value), or null (if null, the filterType defaults to fieldValue).
isRunPageEditableBooleanIndicates if this is an editable filter in the user interface.
operatorStringUnique API name for the condition used to filter a field such as “greater than” or “not equal to.” Filter conditions depend on the data type of the field. Valid values are equals, notEqual, lessThan, greaterThan, lessOrEqual, greaterOrEqual, contains, notContain, startsWith, includes, excludes, or within (DISTANCE criteria only).
valueStringValue by which a field is filtered. For example, the field Age can be filtered by a numeric value. For datetime fields, if you make a POST request and specify a calendar date without including a time, then a default time gets included. The time defaults to midnight minus the difference between your timezone and Greenwich Mean Time (GMT). For example, if you specify 8/8/2015 and your timezone is Pacific Standard Time (GMT-700), then the API returns 2015-08-08T07:00:00Z.

Example filterType. In this example, the first filter is a field-to-field filter that compares the Amount field with Projected Amount field. The second filter is a field filter that returns records for which a row-level formula returns more than 0.

1"reportFilters" : [ {
2      "column" : "AMOUNT",
3      "filterType" : "fieldToField",
4      "isRunPageEditable" : true,
5      "operator" : "notEqual",
6      "value" : "PROJECTED_AMOUNT"
7    }, {
8      "column" : "CDF1",
9      "filterType" : "fieldValue",
10      "isRunPageEditable" : true,
11      "operator" : "greaterThan",
12      "value" : "0"
13} ]

Bucket field

PropertyTypeDescription
bucketTypeBucketTypeThe type of bucket. Possible values are number, percent, and picklist
developerNameStringAPI name of the bucket.
labelStringUser-facing name of the bucket.
nullTreatedAsZeroBooleanSpecifies whether null values are converted to zero (true) or not (false).
otherBucketLabelStringName of the fields grouped as “Other” (in buckets of BucketType PICKLIST).
sourceColumnNameStringName of the bucketed field.
valuesArray of BucketTypeValuesDescribes the values included in the bucket field..

Bucket field value

PropertyTypeDescription
labelStringThe user-facing name of the bucket.
sourceDimensionValuesStringA list of the values from the source field included in this bucket category (in buckets of type PICKLIST and buckets of type TEXT).
rangeUpperBoundDoubleThe greatest range limit under which values are included in this bucket category (in buckets of type NUMBER).

Cross filter

PropertyTypeDescription
criteriaArray of Filter details[]Information about how to filter the relatedEntity. Use to relate the primary entity with a subset of the relatedEntity.
includesObjectBooleanSpecifies whether objects returned have a relationship with the relatedEntity (true) or not (false).
primaryEntityFieldStringThe name of the object on which the cross filter is evaluated.
relatedEntityStringThe name of the object that the primaryEntityField is evaluated against. (The right-hand side of the cross filter).
relatedEntityJoinFieldStringThe name of the field used to join the primaryEntityField and relatedEntity.

Custom Detail Formula

PropertyTypeDescription
decimalPlacesIntegerFormats the value returned by the row-level formula. It is required for numeric return values, invalid for non-numeric return values.
descriptionStringUser-defined description of the row-level formula.
formulaStringSpecifies the formula expression to be evaluated. All report type fields, except bucketed fields and historical tracking fields can be referenced.
formulaTypeStringSpecifies the return type of the formula. Valid values include date, datetime, number, or text.
labelStringSpecifies a name for the row-level formula.

Custom summary formula

PropertyTypeDescription
labelStringThe user-facing name of the custom summary formula.
descriptionStringThe user-facing description of the custom summary formula.
formulaTypeStringThe format of the numbers in the custom summary formula. Possible values are number, currency, and percent.
decimalPlacesIntegerThe number of decimal places to include in numbers.
downGroupStringThe name of a row grouping when the downGroupType is CUSTOM. Null otherwise.
downGroupTypeStringWhere to display the aggregate of the custom summary formula. Possible values are all, custom, and grand_total.
acrossGroupStringThe name of a column grouping when the accrossGroupType is CUSTOM. Null otherwise.
acrossGroupTypeStringWhere to display the aggregate of the custom summary formula. Possible values are all, custom, and grand_total.
formulaStringThe operations performed on values in the custom summary formula.

Top rows

PropertyTypeDescription
rowLimitIntegerThe number of rows returned in the report.
directionStringThe sort order of the report rows.