In my previous blogpost about Power Apps and Project Oakdale, we learned how to create an app with a many-to-many relationship using the new light version of CDS that was introduced together with Project Oakdale.
In that blogpost, we created some tables. One of them is the “Company” table.
It can occur that a company does not exist in the table yet. When someone adds a new company to the table, we want to be notified.
To be aware of newly added companies, we want to create a flow that notifies us when a new company has been created.
Let’s go to Power Apps within Teams and click “Build”:
Click “See all”:
Click “Flows” in the menu:
Create a new automated flow:
Search for the “When a record is created, updated or deleted” trigger. This is an action of the “Common Data Service (current environment)” connector.
Choose a trigger condition out of the list. We have a lot of options to choose from.
- Create of Delete
- Create or Update
- Create or Update or Delete
- Update or Delete
Select the table (entity) for which you want to be notified when a new item is added.
Define the “Scope”. Use scopes to define when your flow need to run. This can be when someone in your business unit or any user in your organization creates a record. See table below or the link below the table for more detailed information about that.
|Business Unit||Action is taken on a record owned by your business unit|
|Organization||Action is taken by anyone within the organization or database|
|Parent: Child business unit||Action is taken on a record owned by your business unit or a child business unit|
|User||Action is taken on a record owned by you|
Our trigger for CDS in Project Oakdale is added and complete. Let’s continue with the rest of the flow.
Add another action to send the email. The complete flow looks like below.
Save your flow.
Go to the “Company” table and add a new company to the table by clicking “Visual editor”.
Add a new company with the name you want. Make sure that your new record is saved before closing.
Go back to the “Flow” overview and click on your new flow.
In some seconds, you will see that in the “Run history” that your flow was executed. Click the blue reload action on the top right if you don’t see any runs yet.
If the flow run succeeded, you should have received the mail:
We can conclude that the triggers when using CDS as data layer are a bit different than when having SharePoint as data layer.
The biggest advantage of CDS is that it is part of the solution package. This is important, because when you have multiple environments: DEV, UAT and PROD it can be easily moved between the environments. When your data layer is SharePoint, you have to migrate your site every time to keep the structure of your lists or document libraries consistent.