[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.

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

Examples

if (FALSE) {
# 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)
}