D365 – Shifting from Dynamics Workflow to Power Automate flow
First things first, Microsoft Flow is now Power Automate.
If you are either a dynamics developer or administrator, off late you might have noticed a flashing banner while creating new Process from Dynamics instance.
From the banner, its clear that Microsoft recommends ‘Power automate flows’ over conventional ‘Process’.
In this article, I am going to cover basics of following items, which helps you in decision making to some extent.
- Common Data Service (CDS) vs Dynamics 365 connector
- Automated flow vs Instant flow (i.e., On-demand process)
- Formatting Dates
Lets get in to the details.
CDS connector vs Dynamics connector:
When you are creating a flow, you need to choose b/w CDS and Dynamics connector.
The key differentiation when switching from Dynamics ‘Process’ to ‘Flow’ is,
- With CDS connector you can set ‘Scope’ and ‘Filter Attributes’ but not with Dynamics connector.
Lets understand this with an example.
Create a flow with CDS connector:
- Connect to your Power automate portal
- Click on ‘+ Create’ tab and choose ‘Automated flow’
- In the new window, choose the ‘Common Data Service’ connector.
- Under the ‘Triggers’, select ‘When a record is updated’ trigger.
- If you notice, under ‘When a record is updated’, there are ‘Scope’ and ‘Attribute Filter’ options.
- Scope : Scope decides the affected records up on flow execution. Get more details here.
- Attribute Filter: If no filtering attributes are set flow will execute on every field updates. Add attribute filters to minimize flow execution, only on specified field updates.
- Now add an action from the ‘Actions’ list. I’ve added a ‘Create a new record’ action.
Create a flow with Dynamics 365 connector:
- Connect to your Power automate portal
- Click on ‘+ Create’ tab and choose ‘Automated flow’
- In the new window, choose the ‘Dynamics 365’ connector.
- Under the ‘Triggers’, select ‘When a record is updated’ trigger.
- This time, under ‘When a record is updated’ there are NO ‘Scope’ and ‘Attribute Filter’ options.
- Which means, the flow will trigger on all field updates and there is no provision of ‘Attribute Filter’ in Dynamics 365 Connector.
Automated flow vs Instant flow (i.e., On-demand process):
One of the common questions from Admins is, how can they create an ‘On-demand’ power automate flow similar to conventional ‘On-demand’ workflow. The answer is Instant flow.
Lets see how to create a simple on-demand flow and run.
Create an Instant Flow:
- Connect to your Power automate portal
- Click on ‘+ Create’ tab and choose ‘Instant flow’
- Note: You can also create ‘Instant flow’ from Dynamics application.
- Go to the entity, from ‘Flow’ menu, click on ‘Create a flow’.
- In the new window, choose the ‘Common Data Service’ connector.
- Under the ‘Triggers’, select ‘When a record is selected’ trigger.
- Select the ‘Environment’ and ‘Entity Name’
- Environment: If you want your flow to always trigger based on an event in a specific environment, select that environment or Choose (Default), which will always use the database within the environment in which Power Automate runs.
- Now add an action from the ‘Actions’ list. I’ve added a ‘Create a new record’ action.
- In above screen, I am setting ‘Transaction Audit’ entities ‘Name’ field with concatenating ‘Transactions’ entities ‘Name’ and current date (i.e., utcNow()).
- Use ‘Dynamic content’ window, to refer the values from Previous step.
Trigger Instant Flow:
- Connect to Dynamics instance and open the record for which you have flow registered. In my case, my flow registered on ‘Transaction’ Entity.
- From the ‘Flow’ menu, select your flow.
- Click on ‘Run flow’
- Make sure you got the success screen as below.
- Now check whether the Action executed. In my example, I am creating a child record (i.e., Transaction Audit)
Formatting Dates:
If you would have noticed the previous screen, the ‘Name’ field of the ‘Transaction Audit’ was set to UTC date format.
To format the date to your choice, use formatDateTime function in your flow’s ‘Expression’.
Save and run the flow, you should see the formatted date as below.
Notes:
- One more edge CDS connector over Dynamics connector is in terms of execution speed. More details
🙂