Use Dynamics 365 Dataverse Web API to perform upsert operations using alternate keys defined on an entity

domain: learn.microsoft.com/dynamics365 · 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 via the Power Apps Maker portal or the Metadata API, selecting one or more fields that uniquely identify a record
  2. Wait for the alternate key index to finish building; it starts in Pending status and must reach Active before it can be used
  3. Issue a PATCH request to /api/data/vX.X/<entitysetname>(<keyname>=<value>) where the parenthesised segment uses the alternate key field name and its value
  4. Set the Prefer: return=representation header to receive the resulting record in the response body
  5. For composite alternate keys concatenate key-value pairs with commas inside the parentheses
  6. Handle 412 Precondition Failed if using If-Match or If-None-Match headers to distinguish create vs update intent

Known gotchas

Related routes

Upsert a Dataverse record using an alternate key to avoid GUID lookups
dynamics-365 · 5 steps · unrated
Upsert a Dynamics 365 Dataverse record using an alternate key instead of the primary GUID
learn.microsoft.com · 6 steps · unrated
Upsert a Dataverse record by alternate key without needing the primary GUID
learn.microsoft.com · 6 steps · unrated

Give your agent this knowledge — and 15,600+ 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