Dataverse bulk task creation can fail through undefined record references, overlooked operation failures, or results matched to the wrong deals.
Key takeaways
- Check references before sending the batch.
- Read individual results in the response body.
- Keep each request linked to its deal identifier.
Every quarter ends the same way. Deals are still open, reps are behind on follow-ups, and someone asks for every open deal to have a next-step task in Dataverse before the close. Creating those tasks one at a time is slow. A single batch groups those task operations into one request.
The batch itself is well documented. Microsoft's batch guidance says that "You can group multiple operations into a single HTTP request by using a batch operation." That is the good news. The catch is that a batch is not a spreadsheet import. It is one request carrying several operations, and each operation has its own result.
Trouble with bulk task loads usually comes from three places: references between operations in the same batch, how failures are reported back to you, and how results are matched to the deals they belong to. Each one gets its own section below. The post includes a checklist you can run before you send anything, and a simple way to rehearse the run before quarter end.
Why quarter end makes this harder
Batch problems are a nuisance on a normal Tuesday. At quarter end they are expensive, for three reasons. First, the list is longer than usual, because reps have been sitting on follow-ups all quarter and the revenue review wants a clean pipeline. Second, the people running the load are often not the people who wrote the script, so nobody remembers which field is limited or which label is which. Third, the deadline leaves no slack. If a batch fails at noon, the fix has to happen before the afternoon review, not next week.
That pressure changes what good practice looks like. You want a process that a revenue operations person can run from a checklist, that reports failures in plain language, and that can be rerun safely. The rest of this post is built around that idea. The advice below does not depend on any particular tool. It requires you to know where the batch can go wrong and to check for those failures before the server does.
Error 1: Referencing a record that does not exist yet
The first error shows up when a batch creates one record and then creates tasks that point at it. Maybe your script creates a new contact for a deal and then a task linked to that contact in the same run. Inside a batch, the task cannot use the contact's real identifier until that contact exists, so it refers to the contact by a label instead. The batch format handles this with Content-IDs: you label an operation, and a later operation refers to that label.
Microsoft's example shows the pattern. "The following example shows how to reference a URI by using $1 in the URL of a subsequent request." In that example, "The URI of the Account entity record is referenced as $1 and the URI of the Contact entity record is referenced as $2 in the PATCH request." The $1 and $2 are labels. Your job is to make sure each label is defined before anything uses it.
The rule that matters is in Microsoft's page: "Referencing a Content-ID before it appears in the request body returns the error HTTP 400 Bad request." The message you will see in the response reads: "Content-ID Reference: '$1' does not exist in the batch context." Note that the error is not about the data. A perfectly valid task with a perfectly valid subject fails if it appears above the contact record in the batch.
Order is part of the design. Dataverse performs these operations sequentially in the order you specify. That makes order a correctness issue, not a cosmetic one. Sorting a list by due date, by owner, or by deal size before you build the batch can move a parent record below its children. Nothing in the data is wrong. The batch simply reads the labels too early.
A simple guard fixes most of this. Before you send, walk the list in order and keep a set of labels already defined. For every operation, check that each label it uses is already in the set. If not, stop the run and fix the list. This is a short step in the script, and it turns a 400 error in the middle of a load into a message you can read at your own desk.
Here is a concrete case. Suppose a rep has a handful of deals that each need a new contact and a follow-up task linked to that contact. A tidy script builds the tasks first, because the task list is what the rep will read. That order breaks the batch, because every task names a contact that has not been created yet. The fix is to reorder the work so that each contact is created first and its task follows, one deal at a time. The list looks less tidy on the screen, but it is the order the batch runs in, and that is the order that matters.
Make labels easy to read as well. When a run fails late on the last day of the quarter, a label that names the parent and its purpose saves time. Keep a written list that links each label to the deal it belongs to, so you are never reverse-engineering the batch from its error.
Error 2: One bad row inside a successful-looking batch
The second error is easy to miss because it looks like success. Microsoft's documentation includes an example that "attempts to create three task records associated with an account with accountid equal to 00000000-0000-0000-0000-000000000001, but the length of the subject property for the first task is too long." One oversized field on one task is enough to create a problem in a set of three.
The header that changes how failures are reported is Prefer: odata.continue-on-error. Microsoft describes its effect this way: "When you add the Prefer: odata.continue-on-error request header to the batch request, the batch request succeeds with a status of 200 OK and the failure of the first request is returned as part of the body." Read that sentence twice. With Prefer: odata.continue-on-error set, a 200 OK can accompany an individual operation's failure. It means the batch request succeeded, and the individual results are in the body.
Teams usually get caught in one of two ways. Either the script checks only the HTTP status and reports "all tasks created," or it checks the body but never counts the failures, so the one missing task is discovered by a rep a week later. Both are avoidable. Treat the body as the real result, and treat every operation as something that needs its own answer.
A total failure is easy to spot, because everyone sees the error and stops. A partial success is different. It arrives as good news, and the good news travels. A manager sees "batch complete" in a log, a dashboard updates, and the quarter's follow-up plan gets built on a count that is wrong. Treat a partial success as a failure until the body has been read and the counts have been checked.
Before the run, check each text field against the limits in your table definition. A subject that fits in a single task record may not fit after your script adds a deal name, a quarter tag, and an owner's initials. Build the subject in the script, measure it, and truncate or flag it on purpose. Do not let the server find the problem for you in the middle of a large run.
After the run, pull out every failed operation and write it to a log with the deal identifier attached. Fix the cause, then resend only the failures. Resending the whole batch is tempting, but it risks duplicating the tasks that already succeeded. Keep the log until the quarter is closed and someone has spot-checked the tasks in the views your team uses.
Error 3: Matching results to the wrong deal
The third error happens after the batch has finished, when someone has to connect each result to a deal. Microsoft's documentation gives you a reliable rule to lean on: "The order of the responses matches the order of the requests in the batch operation." Position is the link between a request and its response. That is useful, and it is also fragile.
Position breaks the moment the list changes between building the batch and reading the results. A common path to the bug: the script builds the requests from one list, then filters that list for a retry or sorts it for a report, and reads the responses against the new version. Now a response is matched to the wrong deal. The rep whose deal failed is told the task exists, and nobody follows up on the deal that actually needs it.
The fix is to stop relying on position alone. Store the deal identifier next to each request at the moment you build it, and keep that mapping in the same structure you use to read the results. Build and read from the same list object, not from a copy that has been sorted or filtered since. Then compare counts before anyone reads a single result, so a missing response is caught as a problem rather than silently skipped.
Also write down the order of the operations in your log. If the batch is retried, you will want to know exactly which deal sat at which position in each run. Those two records together make it possible to answer a simple question later: which deals have a task, and which ones still need one? That question is the whole point of the exercise.
A short spot check closes the loop. After the run, open five or so of the new tasks chosen at random, and confirm each one sits on the deal named in your log. If even one is wrong, stop trusting the mapping and rebuild it from the stored list, not from memory. A few minutes of checking is cheap compared with a rep who has been told about a task that does not exist.
Build the list in layers
Most of the errors above are easier to avoid if the list is built in layers, not in one pass. Start with the deal identifiers, the set of deals that need a task at all. Then add the parent records, in the order they must run. Then add the tasks, each with a label, a subject that has been measured, and a link to the deal it belongs to. Checking each layer on its own is faster than debugging the finished batch.
Keep the layers in separate tables or sheets if you can. A reviewer can then look at the parents, the tasks, and the mapping without reading a wall of generated text. It also makes the rehearsal easier, because you can run one layer at a time.
A checklist before you send
Run these checks on the final list, not the one you started with. Each item should be a yes before the batch leaves your script.
- Every parent record appears before any operation that refers to it by label.
- Every text field has been measured against its table limit, with overflow handled on purpose.
- The batch was built from the same list that holds each deal identifier.
- You have decided whether the continue-on-error header is in use, and the script reads the body either way.
- The number of responses matches the number of requests before any result is read.
- Every failure is logged with its deal identifier, and only failures are resent.
For related preparation, see bulk-edit sales record checks.
Rehearse before the real run
A rehearsal is the cheapest insurance you will buy this quarter. Pick a small set of deals that you know well, run the same script against a test environment or a copy of the data your team uses, and compare the result to what you expected. Include on purpose a deal whose parent record is new, a subject that is too long, and a deal that you expect to fail. If the rehearsal catches a reference or subject-length error, you have found it before the real run.
Timing matters too. A batch that fails on the last afternoon leaves no room to fix it. Start the rehearsal early enough that a failed run still leaves time for a corrected rerun, and do not plan the real load for the final hours before close. The goal is a clean, verified set of follow-up tasks, not a fast upload.
Illustrative example: Trace a failed task
Keep the deal identifier beside each request. If a subject is too long, find its failed response in the body and use the stored mapping to identify the affected deal. Correct that subject and retry the failed operation. Check the resulting task against the log.
Who should own the list
The person who owns the deal list should not be the only person who checks it. The script owner knows how the batch is built. The revenue owner knows which deals are real, which are already closed, and which reps have asked for a follow-up. Those are different kinds of knowledge, and a batch can be correct on one and wrong on the other.
Ask for a short two-person review before each run. One person reads the deal list against the pipeline. The other reads the batch plan, checks the order of parent records, and confirms the counts. Neither review needs to be long. Both catch the kind of mistake that is invisible from inside a single script.
Talking to reps and managers
Reps notice a missing task quickly, often before the log has been read. Tell them up front what will happen. Say that tasks for their deals will be created in one batch, that a task may be missing if its deal failed, and that they should check the log or ask the revenue operations owner rather than create a duplicate by hand. A duplicate task is easy to make and hard to notice in a busy quarter, so the message should be direct about it.
Managers need a different message. They need to know what the count means. If the batch created most tasks and a named set failed, say so with the number of failures and the plan for them. A single clean number hides the failures, and a clear partial result is far more useful for planning the last weeks of the quarter.
If the run fails late
Sooner or later a run will fail near the deadline. Stay calm and follow the same order every time. First, stop any further batches so that nothing else lands on top of the problem. Second, read the body and the log, and sort the failures by cause. Third, fix the causes in the list, not by hand in the system, so the next run is built from corrected data. Fourth, resend only the failed operations, and check the counts again. Last, tell the revenue lead exactly what is done, what is not, and when the rest will be finished.
Do not mark deals as covered in the pipeline review until the matching check passes.
A next step today
Choose a small test deal list today and rehearse the batch before using it on the quarter-end list.
Related guides
Questions about batch errors
What should a failure log include?
Include the deal identifier, operation order and failure cause so you can trace the affected task.
Who should review the batch plan?
The script owner should review the batch plan, while the revenue owner checks the deal list against the pipeline.