Learn R Programming

RForcecom (version 1.1)

rforcecom.createBulkBatch: Create and Add Batches to a Bulk API Job

Description

This function takes a data frame and submits it in batches to a an already existing Bulk API Job by chunking into temp files

Usage

rforcecom.createBulkBatch(session, jobId, data, multiBatch=TRUE, batchSize=10000)

Arguments

session
a named character vector defining parameters of the api connection as returned by rforcecom.login
jobId
a character string defining the salesforce id assigned to a submitted job as returned by rforcecom.createBulkJob
data
a matrix or data.frame that can be coerced into .csv file for submitting as batch request
multiBatch
a boolean value defining whether or not submit data in batches to the api
batchSize
an integer value defining the number of records to submit if multiBatch is true. The max value is 10000 in accordance with salesforce limits.

Value

A list of lists, one for each batch submitted, containing 10 parameters of the batch

References

https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/

Examples

Run this code
## Not run: 
# 
# # inserting 2 records
# my_data <- data.frame(Name=c('New Record 1', 'New Record 2'), 
#                       My_External_Id__c=c('11111','22222'), 
#                       stringsAsFactors=FALSE)
# batches_info <- rforcecom.createBulkBatch(session, 
#                                           jobId=job_info$id, 
#                                           data=my_data, 
#                                           multiBatch=TRUE, 
#                                           batchSize=50)
# #upserting 3 records
# my_data <- data.frame(My_External_Id__c=c('11111','22222', '99999'), 
#                       Name=c('Updated_Name1', 'Updated_Name2', 'Upserted_Record'), 
#                       stringsAsFactors=FALSE)
# batches_info <- rforcecom.createBulkBatch(session, 
#                                           jobId=job_info$id, 
#                                           data=my_data, 
#                                           multiBatch=TRUE, 
#                                           batchSize=50)
# ## End(Not run)

Run the code above in your browser using DataLab