Click here to Skip to main content
15,911,646 members
Articles / Microsoft Flow

Create Contact from Received Email using Flow

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
27 May 2018CPOL3 min read 4.1K   1  
How to create contact from received email using Flow

EmailToCRMUsingFlow2 copy

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:

  1. It integrates different systems and applications
  2. Create workflow and automation tasks
  3. Transfer data between systems
  4. 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”.

    ETOC1

    ETOC2

    CCFEF3

  • Click menu and sign in using your Gmail account using “+ Add new connection”:

    CCFEF4

  • Click “add an action”.
  • Type Dynamics and then click “Dynamics 365 – Create a new record”.

    CCFEF5

  • 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:

    CCFEF7

    CCFEF8

    CCFEF8.1.PNG

  • 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!

    CCFEF9

    CCFEF10 CCFEF11

  • 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.

    CCFEF12

    CCFEF13

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Australia Australia
Developer

Comments and Discussions

 
-- There are no messages in this forum --