CreateBatch
Creates a batch job in Salesforce for bulk processing of records.
Table-Specific Information
To create a batch, specify the Id of the Job you are adding it to and the XML aggregate of the batch itself. For example, the XML aggregate may resemble the following: <Contact><Row><FirstName>Bill</FirstName><LastName>White</LastName></Row><Row><FirstName>Bob</FirstName><LastName>Black</LastName></Row></Contact>
Note: The objects contained in the XML aggregate must all correspond to the object associated with the Job being used.
Input
| Name | Type | Description |
| JobId | String | ID of the Salesforce Bulk API job that the batch will be added to. This must be a valid, open job. |
| Aggregate | String | Data payload or SOQL query for the batch. Required when submitting records or executing batch queries. |
| ContentType | String | Format of the batch content. Valid values are CSV, XML, ZIP_CSV, and ZIP_XML. For batch queries, use CSV.
The default value is XML. |
Result Set Columns
| Name | Type | Description |
| ID | String | Unique ID of the created batch within the job. |
| JobID | String | ID of the job that the batch is associated with, confirming linkage after creation. |
| ApexProcessingTime | String | Total time in milliseconds spent executing Apex triggers and automation during batch processing. Excludes asynchronous Apex and is available in API version 19.0 and later. |
| ApiActiveProcessingTime | String | Time in milliseconds spent actively processing the batch, including Apex time but excluding queue time and serialization. Available in API version 19.0 and later. |
| CreatedDate | String | Timestamp in UTC when the batch was created. This reflects submission time, not the start of processing. |
| NumberRecordsFailed | String | Number of records in the batch that failed to process successfully. |
| NumberRecordsProcessed | String | Number of records that were successfully processed in this batch. This value increases as processing progresses. |
| State | String | Current processing status of the batch. Possible values include Queued, InProgress, Completed, Failed, or NotProcessed. |
| StateMessage | String | Descriptive message about the batch state, especially useful when the state is Failed. May include error reasons or diagnostic info. |
| SystemModstamp | String | UTC timestamp when batch processing was completed. Only valid when the batch state is Completed. |
| TotalProcessingTime | String | Total processing time in milliseconds for the batch, excluding queue wait time. Available in API version 19.0 and later. |