sf_create_attachment | R Documentation |
This function will allow you to create attachments (and other blob data, such as Documents) by supplying file paths (absolute or relative) to media that you would like to upload to Salesforce along with accompanying metadata, such as a Description, Keywords, ParentId, FolderId, etc.
sf_create_attachment( attachment_input_data, object_name = c("Attachment", "Document"), api_type = c("SOAP", "REST", "Bulk 1.0", "Bulk 2.0"), control = list(...), ..., verbose = FALSE )
attachment_input_data |
|
object_name |
|
api_type |
|
control |
|
... |
arguments passed to |
verbose |
|
tbl_df
with details of the created records
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.
Other Attachment functions:
check_and_encode_files()
,
sf_delete_attachment()
,
sf_download_attachment()
,
sf_update_attachment()
## Not run: # upload two PDFs from working directory to a particular record as Attachments file_path1 <- here::here("doc1.pdf") file_path2 <- here::here("doc2.pdf") parent_record_id <- "0036A000002C6MmQAK" attachment_details <- tibble(Body = c(file_path1, file_path2), ParentId = rep(parent_record_id, 2)) result <- sf_create_attachment(attachment_details) # the function supports inserting all blob content, just update the # object_name argument to add the PDF as a Document instead of an Attachment document_details <- tibble(Name = "doc1.pdf", Description = "Test Document 1", Body = file_path1, FolderId = "00l6A000001EgIwQAK", # replace with your FolderId! Keywords = "example,test,document") result <- sf_create_attachment(document_details, object_name = "Document") # the Bulk API can be invoked using api_type="Bulk 1.0" which will automatically # take a data.frame of Attachment info and create a ZIP file with CSV manifest # that is required for that API result <- sf_create_attachment(attachment_details, api_type="Bulk 1.0") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.