[Experimental]

This function is a wrapper around sf_delete that accepts a list of Ids and assumes that they are in the Attachment object and should be deleted. This function is solely provided as a convenience and to provide the last attachment function to parallel the CRUD functionality for all other records.

sf_delete_attachment(
  ids,
  object_name = c("Attachment"),
  api_type = c("SOAP", "REST", "Bulk 1.0", "Bulk 2.0"),
  ...,
  verbose = FALSE
)

Arguments

ids

vector, matrix, data.frame, or tbl_df; if not a vector, there must be a column called Id (case insensitive) that can be passed in the request.

object_name

character; the name of the Salesforce object that the function is operating against (e.g. "Account", "Contact", "CustomObject__c").

api_type

character; one of "REST", "SOAP", "Bulk 1.0", or "Bulk 2.0" indicating which API to use when making the request.

...

arguments passed to sf_control or further downstream to sf_bulk_operation

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 with details of the deleted records

Note

Because the SOAP and REST calls chunk data into batches of 200 records the AllOrNoneHeader will only apply to the success or failure of every batch of records and not all records submitted to the function.

Examples

if (FALSE) {
# upload a PDF to a particular record as an Attachment
file_path <- system.file("extdata",
                         "data-wrangling-cheatsheet.pdf",
                         package = "salesforcer")
parent_record_id <- "0036A000002C6MmQAK" # replace with your own ParentId!
attachment_details <- tibble(Body = file_path, ParentId = parent_record_id)
create_result <- sf_create_attachment(attachment_details)

# now delete the attachment
# note that the function below is just running the following!
# sf_delete(ids = create_result$id)
sf_delete_attachment(ids = create_result$id)
}