sf_update_report: Update a report

View source: R/analytics-report.R

sf_update_reportR Documentation

Update a report

Description

[Experimental]

Save changes to a report by sending a PATCH request to the Report resource. Note that saving a report deletes any running async report jobs because they might be obsolete based on the updates.

Usage

sf_update_report(report_id, report_metadata, 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 representing the properties to create the report with. The names of the list must be one or more of the 3 accepted metadata properties: reportMetadata, reportTypeMetadata, reportExtendedMetadata.

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

list representing the newly cloned report with up to 4 properties that describe the report:

attributes

Report type along with the URL to retrieve common objects and joined metadata.

reportMetadata

Unique identifiers for groupings and summaries.

reportTypeMetadata

Fields in each section of a report type plus filter information for those fields.

reportExtendedMetadata

Additional information about summaries and groupings.

Salesforce Documentation

See Also

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_query_report(), sf_run_report()

Examples

## Not run: 
# first, grab all possible reports in your Org
all_reports <- sf_query("SELECT Id, Name FROM Report")

# second, get the id of the report to update
this_report_id <- all_reports$Id[1]

my_updated_report <- sf_update_report(this_report_id,
                                      report_metadata =
                                        list(reportMetadata =
                                          list(name = "Updated Report Name!")))

# alternatively, pull down its metadata and update the name
report_details <- sf_describe_report(this_report_id)
report_details$reportMetadata$name <- paste0(report_details$reportMetadata$name,
                                             " - UPDATED")

# fourth, update the report by passing the metadata
my_updated_report <- sf_update_report(this_report_id,
                                      report_metadata = report_details)

## End(Not run)

salesforcer documentation built on March 18, 2022, 6:26 p.m.