web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / A substitute for Batch...
Power Pages
Suggested Answer

A substitute for Batch-Dataverse to using in server logic

(1) ShareShare
ReportReport
Posted on by 6
In my procedure, I update and remove sustain values from two dataverse tables. However, there is a catch: we submit about 2000–5000 records in concurrently to both tables.Therefore, we send by batch process on the client side, but can we use the same batch process on the server side? I've noticed that in the $batch HTTP call, we use a header that reads (content-type: "multipart/mixed; boundary=" + batchBoundary).

when utilizing Server.Connector.HttpClient.PostAsync(), which only supports the following Content-Types: application/json, text/html, and application/x-www-form-urlencoded.I just want to be sure it's right or wrong. If the technique is proper, it can provide a helpful option for transmitting records in batches; if it is incorrect, it can share the appropriate header to be used in the $batch for dataverse.

Many thanks.
  • Suggested answer
    11manish Profile Picture
    4,676 Super User 2026 Season 2 on at
    Your proposed server-side batching approach is technically correct.
     
    But there are two key constraints:
    • Dataverse $batch requires Content-Type: multipart/mixed; boundary="..." — not application/json.
    • A single Dataverse batch can contain a maximum of 1,000 individual requests, so your 2,000–5,000 records need to be divided into multiple batches.
    So if Server.Connector.HttpClient.PostAsync() genuinely restricts content types to the three you mentioned, that method cannot directly support Dataverse $batch
     
    in its current form. The correct solution is to extend the HTTP client to allow multipart/mixed (including the dynamic boundary), or use a Dataverse-supported
     
    SDK/helper mechanism that handles batch construction for you.
  • Suggested answer
    Valantis Profile Picture
    7,415 Super User 2026 Season 2 on at
     
    Since you're in a Power Pages server context where HttpClient is restricted, the practical alternative to $batch for 2000-5000 records is using CreateMultiple and UpdateMultiple instead. These are Dataverse bulk operations that accept arrays of records in a single JSON payload, no multipart/mixed needed.

    POST /api/data/v9.2/tablename/Microsoft.Dynamics.CRM.CreateMultiple with Content-Type: application/json and a Targets array in the body. This is supported with standard JSON and handles up to large record sets in one call with higher throughput than $batch.

    If CreateMultiple/UpdateMultiple aren't available for your specific tables (they require custom tables or tables that support elastic), the next option is splitting your records into chunks of 1000 and calling your server-side logic in a loop, each iteration making a standard JSON POST rather than multipart.
     
      Best regards,

    Valantis   ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/ 💼 LinkedIn   ▶️ YouTube
  • Suggested answer
    BilalDev_01 Profile Picture
    115 on at

    Hi,

    You're looking at the right concept, but there is an important distinction here.

    Dataverse Web API does support $batch requests using multipart/mixed with a boundary. However, if Server.Connector.HttpClient.PostAsync() only supports application/json, text/html, and application/x-www-form-urlencoded, then it isn't a suitable mechanism for sending a native Dataverse $batch request because the required multipart/mixed content type cannot be constructed through that method.

    For 2,000–5,000 records, I would avoid trying to send everything as one request anyway. A few options are worth considering:

    • Dataverse Web API $batch – appropriate when you can make the HTTP request directly and construct the required multipart payload correctly. Use smaller batches rather than one huge request.
    • ExecuteMultiple / SDK-based approach – if you're working from server-side .NET code with the Dataverse SDK, this can be a better fit for bulk Create/Update/Delete operations.
    • Upsert where appropriate – if the operation is essentially synchronizing records, Upsert can simplify the server-side logic.
    • Controlled batching + retry logic – regardless of the approach, process records in manageable batches and handle throttling/transient failures with retry/backoff.

    Also keep in mind that $batch doesn't necessarily mean the operations are executed as one atomic transaction. If you require transactional behavior across multiple operations, that's a separate consideration and you may need a changeset.

    So your understanding of the multipart/mixed; boundary=... header is correct. The limitation you're seeing is with the particular HttpClient.PostAsync() abstraction, not with Dataverse $batch itself.

    If you're implementing this in a Dataverse plug-in/custom server-side component, I'd also consider whether making thousands of Web API calls from the server is the best architecture. The Dataverse SDK's bulk-operation capabilities may be more appropriate for this scenario.

  • Suggested answer
    Mohsin Ali Profile Picture
    898 on at
    Hello @Gnanasekar - Your understanding is correct.
     
    Dataverse $batch requires the multipart/mixed content type with a boundary, while Server.Connector.HttpClient.PostAsync() currently doesn't provide the same flexibility for constructing this type of batch request.
     
    Considering you are processing around 2,000–5,000 records, I would go with front-end and back-end approach. So use Server Logic to submit the request to a Power Automate flow or, preferably for this volume, an Azure Function, and let that backend process the records in smaller batches against Dataverse.
     
    So the flow could be:
    Power Pages → Server Logic → Azure Function/Power Automate → Dataverse batches
     
    This will also give you better control over retries, failures, and long-running processing.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Mohsin Ali Profile Picture

Mohsin Ali 43

#2
sannavajjala87 Profile Picture

sannavajjala87 30 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 20 Super User 2026 Season 2

Last 30 days Overall leaderboard