diff --git a/src/NetCoreForce.Client/ForceClient.cs b/src/NetCoreForce.Client/ForceClient.cs index 82ecf0d..b5b6d67 100644 --- a/src/NetCoreForce.Client/ForceClient.cs +++ b/src/NetCoreForce.Client/ForceClient.cs @@ -702,6 +702,38 @@ public async Task ExecuteCompositeRecords( } + /// + /// Execute multiple composite records. + /// The list can contain up to 200 objects. + /// The list can contain objects of different types, including custom objects. + /// + /// The composite request + /// Custom headers to include in request (Optional). await The HeaderFormatter helper class can be used to generate the custom header as needed. + /// List of UpdateMultipleResponse objects, includes response for each object (id, success, errors) + /// Thrown when request fails + public async Task ExecuteCompositeRecords( + CompositeRequest compositeRequest, + Dictionary customHeaders = null) + { + Dictionary headers = new Dictionary(); + + //Add call options + Dictionary callOptions = HeaderFormatter.SforceCallOptions(ClientName); + headers.AddRange(callOptions); + + //Add custom headers if specified + if (customHeaders != null) + { + headers.AddRange(customHeaders); + } + + var uri = UriFormatter.CompositeRequest(InstanceUrl, ApiVersion); + + JsonClient client = new JsonClient(AccessToken, _httpClient); + + return await client.HttpPostAsync(compositeRequest, uri, headers); + } + /// /// Execute request against ApexRest custom endpoints. ///