Get up to Speed Quickly on Power Automate: Triggers (Blog 2 of 5)

Power Automate Triggers explained for D365 System Admin

In the first blog in this series, we identified big picture concepts for Power Automate, and identified Power Automate equivalents to the old, deprecated “Processes” or “Workflow” functionality.  We also identified the one connector you should use to connect to CRM and identified the trigger options.  If you have not read it yet, pls click below.

Day 1 Blog Post – General Power Automate Concepts for the D365 System Admin

In this next blog article, we discuss the trigger options in more detail. 

Tip: The key takeaway is

The syntax with which you refer to CRM fields DIFFERS based on the TRIGGER you select.

This blog describes which Connectors and Triggers to use to connect to Dynamic 365 Dataverse (CRM) data

Building a Flow

Once you select your trigger, the flow building pane will display.  For example, if you are writing a flow that runs on a schedule, after picking the “schedule” trigger, you will see a window like this:

As the tooltip states, now you just add steps to the flow.

We’ll now dive into each of these trigger options in greater detail.

Power Automate Triggers

You can start a Power Automate flow in different ways.  Common ways for CRM admins are: schedule (nightly, etc.), a Dynamics 365 button press, or a trigger based on a database action (Create, Update, or Delete). 

Tip: Note that you can test any trigger type in a similar manner, BUT the syntax for how you refer to fields returned from a trigger versus, for example, using an Advanced Find like list of records, is different.

Select the trigger that you expect to use in production

Trigger choices:

Your choices primarily come down to:

  • 1 – Run it on a schedule (Scheduled Cloud Flow)
  • 2 – Trigger it from a CRM Create/Update/Delete action (Automated cloud flow, or instant cloud flow)
  • 3 – Create a button in the D365 UI that, when clicked, launches this Power Automate flow.

Desktop flow simply refers to a flow you create with Power Automate Desktop, which I must confess to not having used yet.

Business Process flow creates the old (love ‘em or hate ‘em) Business Process Flow feature that creates a ribbon on top of the form with fields you can check to indicate progress.  (I’m in the “hate ‘em” camp, so sorry, you’ll have to find information about this Power Automate trigger somewhere else.)

You can also nest flows.  One way is by making an “HTTP” request to call another flow, as you can see in this great blog post from d365demystified.com

Note: Once you select your trigger, you can’t change it without re-building the flow.  So choose the trigger you want to use in production.

Scheduled Cloud Flow

A Scheduled Cloud Flow is the easiest to understand: it runs at a specified interval you define. 

I typically set the interval to one month while developing a flow so it doesn’t run unexpectedly.

Automated Cloud Flow

If you want to do something when a user saves a record in Dynamics 365 (CRM/CDS/Dataflex/Dataverse model-driven app, or canvas app), select automated cloud flow.

By entering “common” in the “Choose your flow’s trigger” box, you can see the Common Data Service triggers.  Please ONLY select the “When a record is created, updated, or deleted” from the Common Data Service (current environment).  Otherwise you are using a deprecated connector.


Scope

While you have the same choices you do with a workflow, note that a “custom value” can be entered.  (I believe you’d have to pass in a parameter to a sub-flow to derive a valid custom value here.)

Use triggerOutput to refer to fields in the triggering entity

When you use triggers, you have to use the “triggerOutput” expression to refer to fields in the triggering entity.  See this excellent link from D365Demystified for more insight – Trigger output

Run Power Automate flow only when a field value changes

As with workflow (checking the “Record fields change” box, and then selecting the fields you want to monitor for change), you can build it so that your workflow doesn’t fire on just any ol’ update.  Again, there is a lot of fantastic information on this topic. Rather than reinvent the wheel, I point you to these Microsoft pages:

Specify filter expressions on triggers:

https://community.dynamics.com/365/b/linn-s-power-platform-notebook/posts/build-efficient-flows-using-filter-expression-in-cds-current-environment-trigger

When using a trigger, if you have null CRM fields, this fixes that problem:

https://powerusers.microsoft.com/t5/Building-Flows/LaunB2

Instant Cloud Flow

I have not yet used this trigger, but it looks interesting.  “Power Automate” appears to let you obtain input from a Power App and feed that data to a Power Automate flow on the click of a button.  For more detail, see this great blog post from Sharepains.com:

Send your data to microsoft flow

There is also one that says “When a flow step is executed” that lets you trigger a flow from a Business Process Flow.

https://docs.microsoft.com/en-us/business-applications-release-notes/april19/microsoft-flow/instant-steps-business-process-flows

QUICK LINK TO DAY 3: Power Automate: List Rows

Categories:

Leave a Reply

Your email address will not be published. Required fields are marked *