Upsert a Dynamics 365 Dataverse record using an alternate key instead of the primary GUID

domain: learn.microsoft.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Define an alternate key on the Dataverse table in the Power Platform maker portal or via solution import, specifying one or more column logical names that together form a unique key
  2. Wait for the alternate key status to show as Active — key creation indexes the table asynchronously and can take minutes to hours for large tables
  3. Construct the upsert request URL using the alternate key syntax: /api/data/vX.X/<entitysetname>(<keyname>=<value>) for a single-attribute key, or (<key1>=<val1>,<key2>=<val2>) for a composite key
  4. Send a PATCH request with the record data as a JSON body; include the If-Match: * header to update only if the record exists, or omit the header to allow creation if not found (true upsert behavior)
  5. On a 201 Created response the record was inserted; on 204 No Content the record was updated — use these status codes to track create vs. update for downstream logic
  6. Handle 412 Precondition Failed when If-Match: * is used but no matching record exists, and 404 when the alternate key value does not match any record

Known gotchas

Related routes

Upsert a Dataverse record using an alternate key to avoid GUID lookups
dynamics-365 · 5 steps · unrated
Upsert a Dataverse record by alternate key without needing the primary GUID
learn.microsoft.com · 6 steps · unrated
Use Dynamics 365 Dataverse Web API to perform upsert operations using alternate keys defined on an entity
learn.microsoft.com/dynamics365 · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans