| sf_update {salesforcer} | R Documentation |
Update Records
Description
Updates one or more records to your organization’s data.
Usage
sf_update(
input_data,
object_name,
api_type = c("SOAP", "REST", "Bulk 1.0", "Bulk 2.0"),
guess_types = TRUE,
control = list(...),
...,
all_or_none = deprecated(),
verbose = FALSE
)
Arguments
input_data |
named vector, matrix, data.frame, or
tbl_df; data can be coerced into a data.frame. If performing an
update, upsert, or delete operation, then one column or
field must be the Id of the record to modify or delete.
|
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.
|
guess_types |
logical; indicating whether or not to use col_guess()
to try and cast the data returned in the recordset. If TRUE then
col_guess() is used, if FALSE then all fields will be returned
as character. This is helpful when col_guess() will mangle field values
in Salesforce that you'd like to preserve during translation into a tbl_df,
like numeric looking values that must be preserved as strings ("48.0").
|
control |
list; a list of parameters for controlling the behavior of
the API call being used. For more information of what parameters are available
look at the documentation for sf_control.
|
... |
arguments passed to sf_control or further downstream
to sf_bulk_operation
|
all_or_none |
logical; allows a call to roll back all changes unless all
records are processed successfully.
|
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 of records with success indicator
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
## Not run:
n <- 2
new_contacts <- tibble(FirstName = rep("Test", n),
LastName = paste0("Contact", 1:n))
new_records <- sf_create(new_contacts, "Contact")
updated_contacts <- tibble(FirstName = rep("TestTest", n),
LastName = paste0("Contact", 1:n),
Id = new_records$id)
# update and allow fields to be truncated if they are too long
update <- sf_update(input_data = updated_contacts, object_name = "Contact",
AllowFieldTruncationHeader=list(allowFieldTruncation=TRUE))
## End(Not run)
[Package
salesforcer version 1.0.1
Index]