Skip to contents

[Experimental]

Run a report without creating a new report or changing the existing one by making a POST request to the query resource. This allows you to get report data without filling up your Org with unnecessary reports.

Usage

sf_query_report(report_id, report_metadata = NULL, verbose = FALSE)

Arguments

report_id

character; the Salesforce Id assigned to a created analytics report. It will start with "00O".

report_metadata

list; a list with one element named "reportMetadata" having additional list elements underneath. All possible elements of reportMetadata are documented HERE, but you will most commonly only need to specify the following 3 elements to filter or query the results of an existing report:

reportFormat

A character specifying the format of the report with possible values: "TABULAR", "SUMMARY", "MATRIX", or "MULTI_BLOCK".

reportBooleanFilter

A character denoting how the individuals filters specified in reportFilters should be combined. For example, "(1OR4)AND2AND3"

.
reportFilters

A list of reportFilter specifications. Each must be a list with 3 elements: 1) column, 2) operator, and 3) value. You can find out how certain field types can be filtered by reviewing the results of sf_list_report_filter_operators.

verbose

logical; an indicator of whether to print additional detail for each API call, which is useful for debugging. More specifically, when set to TRUE the URL, header, and body will be printed for each request, along with additional diagnostic information where available.

Value

tbl_df

Details

Note that you can query a report's data simply by providing its Id. However, the data will only be the detailed data from the tabular format with no totals or other metadata. If you would like more control, for example, filtering the results or grouping them in specific ways, then you will need to specify a list to the report_metadata argument. The report_metadata argument requires specific knowledge on the structure the reportMetadata property of a report. For more information, please review the Salesforce documentation in detail HERE. Additional references are provided in the "See Also" section.

Salesforce Documentation