From 127e08394a16631275c1ca224e3a00cdf8c6a62d Mon Sep 17 00:00:00 2001 From: Michelangelo Date: Mon, 22 Dec 2025 22:28:50 -0500 Subject: [PATCH] Adds overload to the `ExecuteCompositeRecords()` method so you can pass in the `CompositeRequest` instance yourself without relying on its creation inside the method. --- src/NetCoreForce.Client/ForceClient.cs | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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. ///