Usage
sf_run_bulk_operation(
input_data,
object_name,
operation = c("insert", "delete", "upsert", "update", "hardDelete"),
external_id_fieldname = NULL,
guess_types = TRUE,
api_type = c("Bulk 1.0", "Bulk 2.0"),
batch_size = NULL,
interval_seconds = 3,
max_attempts = 200,
wait_for_results = TRUE,
record_types = c("successfulResults", "failedResults", "unprocessedRecords"),
combine_record_types = TRUE,
control = list(...),
...,
verbose = FALSE
)
sf_bulk_operation(
input_data,
object_name,
operation = c("insert", "delete", "upsert", "update", "hardDelete"),
external_id_fieldname = NULL,
guess_types = TRUE,
api_type = c("Bulk 1.0", "Bulk 2.0"),
batch_size = NULL,
interval_seconds = 3,
max_attempts = 200,
wait_for_results = TRUE,
record_types = c("successfulResults", "failedResults", "unprocessedRecords"),
combine_record_types = TRUE,
control = list(...),
...,
verbose = FALSE
)
Arguments
- input_data
named vector
,matrix
,data.frame
, ortbl_df
; data can be coerced into CSV file for submitting as batch request- object_name
character
; the name of the Salesforce object that the function is operating against (e.g. "Account", "Contact", "CustomObject__c").- operation
character
; string defining the type of operation being performed- external_id_fieldname
character
; string identifying a custom field on the object that has been set as an "External ID" field. This field is used to reference objects during upserts to determine if the record already exists in Salesforce or not.- guess_types
logical
; indicating whether or not to usecol_guess()
to try and cast the data returned in the recordset. IfTRUE
thencol_guess()
is used along withanytime()
andanydate()
. IfFALSE
then all fields will be returned as character. SpecifyingFALSE
helpful when guessing the column data type will result in NA values and you would like to return the results as strings and then cast in your script according to your unique specifications.- api_type
character
; one of"REST"
,"SOAP"
,"Bulk 1.0"
, or"Bulk 2.0"
indicating which API to use when making the request.- batch_size
integer
; the number of individual records to be included in a single batch uploaded to the Bulk APIs (1.0 or 2.0).- interval_seconds
integer
; defines the seconds between attempts to check for job completion.- max_attempts
integer
; defines then max number attempts to check for job completion before stopping.- wait_for_results
logical
; indicating whether to wait for the operation to complete so that the batch results of individual records can be obtained- record_types
character
; one or more types of records to retrieve from the results of running the specified job- combine_record_types
logical
; indicating for Bulk 2.0 jobs whether the successfulResults, failedResults, and unprocessedRecords should be stacked together by binding the rows- 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 forsf_control
.- ...
other arguments passed on to
sf_control
orsf_create_job_bulk
to specify thecontent_type
,concurrency_mode
, and/orcolumn_delimiter
.- verbose
logical
; an indicator of whether to print additional detail for each API call, which is useful for debugging. More specifically, when set toTRUE
the URL, header, and body will be printed for each request, along with additional diagnostic information where available.
Note
With Bulk 2.0 the order of records in the response is not guaranteed to match the ordering of records in the original job data.