7 min readRishi

Detecting Create vs Update Triggers in Dataverse Power Automate Flows

In this series: Power Automate gotchas

Detecting Create vs Update Triggers in Dataverse Power Automate Flows

The Dataverse connector's "When a row is added, modified or deleted" trigger fires for multiple operation types. When your flow needs different logic for creates versus updates, here is how to detect which one fired.

Read SdkMessage, do not guess

The current Dataverse connector provides the trigger type directly in the trigger outputs:

@triggerOutputs()?['body/SdkMessage']

This returns one of:

  • Create — a new row was added
  • Update — an existing row was modified
  • Delete — a row was removed

After one unfiltered run, look at the trigger body you actually received. Use SdkMessage. Use the row id (item/accountid or whatever the table uses). Use the columns you asked for. Do not look for _previousValue_*. Do not look for MessageName unless the payload you just opened actually has it. The JSON in front of you is the contract.

If SdkMessage is empty, the flow is probably on an older trigger shape or a different connector. Do not invent a path. Take the condition off, run once, and read the body. Same habit as trigger conditions.

Switch after the trigger

Add a Switch action right after the trigger.

Switch on: @triggerOutputs()?['body/SdkMessage']

Case: Create — defaults, welcome notification, related records.

Case: Update — compare values, approval, external sync.

Case: Delete — archive, clean up related data, notify.

The default branch should Terminate or log and stop. A value you did not plan for should not fall into Update and write to another system.

Delete runs do not give you a full live row. If you need columns for the archive, copy them before the delete. The Switch cannot invent a pre-image the trigger never sent.

There is no pre-image on the trigger body

For updates, you often want to know what actually changed. Unlike a Dataverse plug-in, the Power Automate trigger does not give you pre-operation values. There is no _previousValue_* property on the trigger body, and this is a long-standing gap that the community has open ideas requesting.

Three patterns that work today:

  1. Maintain a "last known value" column. When you care about transitions on a specific field (e.g., statuscode), keep a shadow column you write to on every change, and read from on the next run.
  2. Use Dataverse audit history. If auditing is on for the table, your flow can retrieve change history for the row and read the previous value as part of the run. Heavier than a column compare, but no schema changes.
  3. Move the comparison server-side. A real-time Dataverse plug-in registered on PreUpdate has the previous values in its plug-in execution context. Use a plug-in to detect the transition and a flow to react.

Whichever path you pick, do not reach for a property on the trigger body that does not exist.

Walk-through: a shadow column for statuscode

Suppose the rule is "email the owner when statuscode moves to a new value, not when the description is edited, and not when someone saves the same status again."

Add one custom column on the table that stores the last statuscode the flow already handled. A whole-number or choice column is enough. It is not for users. Hide it on the form.

Configure the trigger:

  • Change type: Modified
  • Select columns: statuscode only
  • Filter rows: whatever still applies, for example statecode eq 0

The first actions:

  1. Compose the incoming statuscode from the trigger body.
  2. Compose the shadow column from the same body, or Get a row if you did not include the shadow column in the payload you actually have.
  3. Condition: incoming equals shadow. If yes, Terminate as succeeded. Nothing to do. Someone saved the same status, or this is the echo of your own write.
  4. If no, send the email. Then Update a row and write the incoming statuscode into the shadow column.

That last write loops if Select columns is wrong. The shadow update is itself a Dataverse update. If Select columns is empty, the flow starts again. With Select columns set to statuscode only, the shadow write does not start the flow. That is why the list exists, as in Select columns.

Seed the shadow on Create — write the initial statuscode, skip the email — or set a default so the first real change has something to compare. An empty shadow and a real statuscode looks like a transition. Do not put the shadow column in Select columns. You would wake the flow on your own write.

Audit history and a PreUpdate plug-in

Audit is the no-schema option. Turn it on for the table and for statuscode. In the Update branch, retrieve change history and read the previous statuscode. Extra call, depends on retention, fails if someone disabled auditing. Use it when you cannot add a column and the transition is rare.

A plug-in on PreUpdate is the precise option. The execution context already has the pre-image. The plug-in compares statuscode, then starts a flow or writes a flag column Select columns can see. The plug-in decides whether there was a transition. The flow decides what to do.

Tradeoff: a plug-in is ALM and a server-side failure mode. A shadow column is a schema change and a write on every handled update. Audit is configuration and retention. None of them is a hidden property on triggerOutputs.

Filter before you Switch

Instead of detecting the type in-flow, filter at the trigger level first:

  1. Set Change type to only the operations you care about (Added, Modified, Deleted, or a combination)
  2. Use Filter rows to further narrow which records fire the flow (statecode eq 0, statuscode eq 1)
  3. Use Select columns to decide which updates are allowed to start the run

If the flow only handles creates, do not subscribe to updates and then Switch on SdkMessage. You still pay for the run. Keep SdkMessage for the flows that genuinely share most steps across create and update.

Share a flow only when the steps actually overlap

For flows where create and update share most logic but differ in a few steps:

  1. Run shared validation and data enrichment first
  2. Use a Condition or Switch to branch only where behavior differs
  3. Converge back to shared post-processing

This avoids two nearly identical flows. It is the wrong shape when the branches share a trigger and almost nothing else. Two flows, two Change types, is cheaper to debug than one Switch with two unrelated bodies.

Skip the Switch when the flow only handles one operation — set Change type instead — or when you need the previous value. SdkMessage does not provide a pre-image.

If SdkMessage is empty

  • Confirm you are on the Dataverse trigger, not an older Common Data Service shape you never migrated.
  • Peek the trigger raw outputs from a successful run. Copy the path you see, not the path a blog comment remembers.
  • If the body has the operation under a different name in that payload, use that name. If it does not, split Change type across two flows.
  • A Create test and an Update test should land in different Switch cases. If both land in default, the expression path is wrong.

Use triggerOutputs()?['body/SdkMessage'] to detect the operation type. Filter at the trigger when you can. The trigger does not expose pre-update values — keep that comparison in a shadow column, audit, or a plug-in.

Keep reading

Newsletter

New posts, straight to your inbox

One email when a new post goes up. Double opt-in, unsubscribe anytime. Not a daily digest.

Comments

  • No comments yet. Be the first.