Schedule – Recurrence trigger inside Microsoft Flow makes it extremely easy and effective to write a recurring job specially in the context of Dynamics 365, wherein it isn’t straight forward. We can use Workflows with wait and timeout conditions but that isn’t the easiest and efficient way. Each approach has its own pros and cons though.
The scenario we are going to implement is getting basic details of all the leads record created every hour inside Dynamics 365 CE and create a Task in todoist to call that lead.
Login to Microsoft Flow
Navigate to My flows and select Create from blank
Search for recurrence trigger and select it.
Specify interval as 1 and frequency as hour and click on New step and select “Add an action”
To get the records from Dynamics 365 CE, we need to use “Dynamics 365 – List records” action. Search for the same and add it.
For List records action, select the organization in the Organization Name, Leads for the Entity Name and for filter query specify “createdon ge addHours(utcNow(), -1)“: i.e. lead records created in last one hour as shown below
Add a new step “Add an apply to each”
Select value (list of items) for “Select an output from previous steps” field of Apply to each and click on Add an action.
Search for todoist and select Create a task action. Login or create a new account in Todoist.
Specify Inbox as the Project Id and for the title use the dynamic value of lead i.e. Last Name, First Name and Mobile Phone.
Save the Flow and click on Test to see it in action.
The run activity will show the status of test run along with any error during the flow execution. In our case it has ran successfully.
Inside Todoist we can see the task created.
Hope it helps..