Use Microsoft Flow to Conditionally Update a Contact from a SharePoint List (Part III)

In the last part of this tutorial, I will add some finishing touches to Flow.  Since the default CRM Contact entity more than one email address field, the Filter Query should check all three email address fields, emailaddress1, emailaddress2 and emailaddress3.  The No Condition result will also need to be fixed so the correct email address field gets updated.  This tutorial assumes you have a working Flow between SharePoint online and Dynamics 365 (online).

  1. Access My Flows and open the Flow between SharePoint online and Dynamics 365 labeled, “When an item is create -> Create a new record
  2. Edit the Flow and click on List records

  3. Click on the link to expand the advanced options

  4. Click once on the Filter Query field and open the Expression.  The Expression value should appear.  Copy the Expression value.
  5. With the Expression value in the clipboard, click back on the Filter Query field and add the 2 other email address fields (from Dynamics 365).  Use the or operator in between each statement.  For now, don’t include the Expression value.  Note that the filter is case sensitive.
  6. Click within the two single quotes for emailaddress2 and then paste the Expression value into the Expression field.
  7. Repeat the previous step for emailaddress3 and the Filter Query field should look like this:
  8. If I leave this Flow as it is, when a new Contact’s email address matches the emailaddress2 or emailaddress3 field, the current Update a record will update the emailaddress1 field.
  9. Let’s replace the Email Address fields with if statements that checks if the SharePoint email address value matches each of the CRM email address fields.  Click on the Email field in the Expression field add the value:
    if(equals(triggerBody()?[‘Title’],items(‘Apply_to_each’)?[’emailaddress1′]), triggerBody()?[‘Title’], items(‘Apply_to_each’)?[’emailaddress1′])

    The if statement is the equivalent to saying:

    IF <strong>SharePoint Email</strong> EQUALS <strong>CRM Email Address 1
    </strong> THEN Display <strong>SharePoint Email
    </strong>ELSE Display <strong>CRM Email Address1</strong>
  10. Repeat the previous step for Email Address 2 and change the Expression field to the value:
    if(equals(triggerBody()?[‘Title’],items(‘Apply_to_each’)?[’emailaddress2′]), triggerBody()?[‘Title’], items(‘Apply_to_each’)?[’emailaddress2′])

  11. Repeat the previous step for Email Address 3 and change the Expression field to the value:
    if(equals(triggerBody()?[‘Title’],items(‘Apply_to_each’)?[’emailaddress3′]), triggerBody()?[‘Title’], items(‘Apply_to_each’)?[’emailaddress3′])
  12. The three Email fields should look like this:
  13. Now click on the Update flow button at the top of the page.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.