R/analytics-report.R
sf_query_report.Rd
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.
sf_query_report(report_id, report_metadata = NULL, verbose = FALSE)
character
; the Salesforce Id assigned to a created
analytics report. It will start with "00O"
.
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:
A character
specifying the format of the report
with possible values: "TABULAR"
, "SUMMARY"
, "MATRIX"
,
or "MULTI_BLOCK"
.
A character
denoting how the individuals
filters specified in reportFilters
should be combined. For example,
"(1OR4)AND2AND3"
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
.
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.
tbl_df
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.
Other Report functions:
sf_copy_report()
,
sf_create_report()
,
sf_delete_report()
,
sf_describe_report_type()
,
sf_describe_report()
,
sf_execute_report()
,
sf_list_report_fields()
,
sf_list_report_filter_operators()
,
sf_list_report_types()
,
sf_list_reports()
,
sf_run_report()
,
sf_update_report()