Last week in a meeting, a client explained requirements:
“.. we receive emails in a mail box, and we manually create contacts in CRM using sender name and address for further processing, we want to automate this.. .”
This task was going to extend existing system functionality but there was no existing code to reuse or modify and of course, the expectation was to deliver this soon. So it was a perfect case to use Microsoft Business Application Platform. In this post, I will explain how easy it was to provide solution using Flow.
New to Flow?
Flow is part of Business Application Platform and it is the latest service from Microsoft to create automated workflow. It is intended for business and power users so most of the time, tasks can be performed without writing a single line of code. Some of its cool features are:
- It integrates different systems and applications
- Create workflow and automation tasks
- Transfer data between systems
- Can be used easily with a bunch of other Microsoft technologies
To get started, the first step is to sign up at flow.microsoft.com. Currently, there is a basic “Flow Free” plan which is free, for more details about pricing, see this.
How Flow Work?
There are three basic components in Flow which are connector, trigger and action.
Connector is used to connect to source and target system. A few examples of connectors are Dynamics 365, OneDrive, Gmail, Twitter, Excel, Azure Storage, Oracle, DB2, RSS, Eventbrite or Youtube. At the time, almost 227 connectors are available and hopefully this number will increase.
A trigger is an event that occurs inside the connector. For example, with SharePoint, a few triggers are:
- File creation
- Deletion of a file
- File modification
Similarly, a trigger with Gmail is when a new email arrives. A connector can have multiple triggers and in a flow, usually we choose a trigger which starts execution of flow.
After selecting trigger, normally the next step will be to choose a target system or service (again using connector). Similar to triggers with source connector, a target connector may have multiple associated actions to chose from. For example, Office 365 Outlook has:
- Create Contact
- Send Email
- Create Event
By choosing an action, we tell what should happen to target system or server. Good thing is we can choose multiple actions which will be performed one by one. For example, we can create a flow which on receiving an email will send a SMS, create a file in Sharepoint and also create record in Dynamics 365.
Solution
- Sign in to https://flow.microsoft.com/ and click “See all” link.
- Search and select Gmail.
- Click “When a new email arrives”.
- Click menu and sign in using your Gmail account using “+ Add new connection”:
- Click “add an action”.
- Type Dynamics and then click “Dynamics 365 – Create a new record”.
- Click menu and then from “+ Add new connection”, sign in to Dynamics 365 account.
- Select your Dynamics 365 organization name in “Organization Name” field.
- Select ‘Contact’ as entity from “Entity Name” field
- After selecting entity name, more fields will be loaded in “Create a new record” form:
- In form, click “Last Name” and then from dynamic content list, select “Sender’s Name”.
- Similarly, select “Email” in create a new record form and then from dynamic content “From” email address.
- Press Save button to save the Flow and that is all!
- Send email to linked account and after 3-4 seconds, verify new contact created in Dynamics 365 from email received.
- Click “My flows” link and then click flow listed to verify its execution was successful.
Note
This demo was created using Gmail, but for Outlook, “Outlook.com” and “Office 365 Outlook”, two connectors are available. One catch though is at the time they do not offer senders name as dynamic content. A solution can be to redirect Outlook emails to a Gmail box and configure Gmail to create contact in Dynamics 365.
Get in-touch, follow me on twitter: @yaweriqbal and on Linkedin: yawer.iqbal
CodeProject