sf_update_attachment {salesforcer} | R Documentation |
Update Attachments
Description
This function will allow you to update attachments (and other blob data, such as
Documents) by providing the Id of the attachment record and the file paths
(absolute or relative) to media that you would like to upload to Salesforce
along with other supported metadata for this operation (Name
,
Body
, IsPrivate
, and OwnerId
).
Usage
sf_update_attachment(
attachment_input_data,
object_name = c("Attachment"),
api_type = c("SOAP", "REST", "Bulk 1.0", "Bulk 2.0"),
control = list(...),
...,
verbose = FALSE
)
Arguments
attachment_input_data |
|
object_name |
|
api_type |
|
control |
|
... |
arguments passed to |
verbose |
|
Value
tbl_df
with details of the created records
Salesforce Documentation
Note
The length of any file name can’t exceed 512 bytes (per Bulk 1.0 API). The SOAP API create call restricts these files to a maximum size of 25 MB. For a file attached to a Solution, the limit is 1.5 MB. The maximum email attachment size is 3 MB. You can only create or update documents to a maximum size of 5 MB. The REST API allows you to insert or update blob data limited to 50 MB of text data or 37.5 MB of base64–encoded data.
See Also
Other Attachment functions:
check_and_encode_files()
,
sf_create_attachment()
,
sf_delete_attachment()
,
sf_download_attachment()
Examples
## Not run:
# 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)
# download, zip, and re-upload the PDF
pdf_path <- sf_download_attachment(sf_id = create_result$id[1])
zipped_path <- paste0(pdf_path, ".zip")
zip(zipped_path, pdf_path)
attachment_details <- tibble(Id = create_result$id, Body = zipped_path)
update_result <- sf_update_attachment(attachment_details)
## End(Not run)