Support Portal ContactGet in touch

Using Flow as a Cloud Workflow–Worked Example

   Words by Paul McQuillan

   on 28/03/2018 08:00:00

imageDynamics has always had an excellent Workflow Engine to add automated logic or tasks to a solution.

However this Workflow is restricted to actions within CRM itself, and needs additional input from a Plugin or Custom Workflow Action to implement logic outside CRM for calling a Webservice or implementing other Integrations.

Flow changes the rules for us here – in allowing a shared platform to run actions by calling Web Connected APIs, and so give us Flow Processes that are able to interact with various other Apps and Services available to our Cloud.

Particularly if we are using the Microsoft Cloud for Office 365, SharePoint and Dynamics, we can use Flow to bring the systems together as a single solution with Workflow spanning each of the systems involved. 

We can also use Flow to interact with Custom Webservices available to our Solution – and so exchange data with 3rd party webservices.

To look at this in detail, we can review the following worked example which will build a Flow that triggers from a new record in Dynamics, call out to a 3rd Party Webservice, parse the return, and then use this to create and send a new Email from Office 365. 

1. Define a Trigger based on Dynamics - Define our trigger, so we could ask our logic to trigger whenever a new Case record is created in CRM

image

2. Call Custom Webservice - As a second step, we can ask our Flow to call out to a Custom Webservice by building the JSON Call from variables retrieved from the Case record in CRM.

image

In this example, using the DocMan Webservice to generate a new Access Key to build a link for the Customer to view the Case online via 3rd Party Portal.

The Webservice will then return a JSON Response as the Body of the Http Action – which we will use in our next action.

3. Parse the JSON Response – As our Webservice is a custom JSON Method, this response will be returned as a block response.

We can use a Parse JSON Compose Action to translate the Response Body in typed variables that we can use in subsequent actions in our Flow.

To use this Parse Action, our best approach is to run the Webservice or Function in a controlled test to return the raw JSON Response – and then copy this Response into the Action so the Action can parse this into the relevant variables.

image

4. Read the Owner of the Case from Dynamics – if we want to Email a User or Customer as the end result of the Flow, then we need to read the Email Address for the record in CRM that we want to Email.

Note for Dynamics veterans – in a 'normal’ Dynamics Workflow, we can simply specify the [Owner] of the Case as the ‘To’ of the Email and this will handle the translation to sending the Email to the Owner’s Email Address; however Flow will interpret [Owner] as the User’s GUID Id rather than the User’s Email Address.  So we need this step to read the ‘systemuser’ record for the [Owner] to get the value of the Primary Email Address field for the User.

image

5. Use Office 365 to Send the Email – finally we can create an Action for Office 365 to create and send the Email.

This differs from our usual Dynamics Workflow where we create the Email as a Record in Dynamics, and then use Dynamics to send the Email. (typically using Server-side Sync with Exchange, or via the Email Router)

image

In this example, we instead push the email directly through Office 365 as using Flow we are capable of treating Office 365 as a connected Web Application as opposed to be limited to tools inside Dynamics itself.

For the Email we can use:

  • The Primary Email Address read from the User record in Dynamics in Step 4
  • The Case Title and Ticket Number from the Case record that triggered our Flow in Step 1
  • The Access Key from the JSON Response produced by our Custom Webservice in Step 2, and parsed to the URL variable by the Parse JSON Action in Step 3

The Email is then composed from each of these 3 sources.

We can then publish our Flow and test.

Flow Outcome

We can test the Flow by simply creating a new Case in Dynamics.

image

The creation of the Case activating the trigger for the Flow via the hook from Dynamics to Flow.

We can then view the performance of the Flow in much the same way as we can view the performance of a Workflow in Dynamics:

image

Our final outcome then being the Email which we should receive:

image

In our example providing us (or the Customer) with a link where they can then view the Public Face for the Case, and help us collaborate to the Case Resolution.

image

This ability to configure Flows as Workflow across different systems gives us a powerful tool to bring functionality from various systems into our a unified solution – and so allow us to bring additional functionality into Dynamics without developing this from the ground up.

As an example, this gives us the potential to get the best from SharePoint, the best from our Services available to us, and bring this into CRM by Flow – rather than having to build this functionality into CRM, or building complex engines to integrate this functionality into CRM.

Using Flow, we can also trigger actions from these systems – so creating a new CRM Record in response to an Email being received by Office 365, or creating a CRM Task in response to a File being uploaded to a certain SharePoint Location.  This gives us powerful tools for Email-to-Case functions, or Tasks to help collaborate in reviewing a Document.

We can then use CRM as a Platform for functionality across different Cloud Systems, and so give us a connected solution rather than a solution built over different pieces of development.

Further Reading

Using Microsoft Flow with Web Services to send messages to Microsoft Teams

https://blogs.technet.microsoft.com/stefan_stranger/2017/06/01/using-microsoft-flow-with-web-services-to-send-messages-to-microsoft-teams/ 

Dynamics CRM Workflow vs Microsoft Flow

https://us.hitachi-solutions.com/blog/dynamics-365-workflow-vs-microsoft-flow/ 

Create a Flow with Dynamics 365

https://docs.microsoft.com/en-us/flow/connection-dynamics365

Share this Article

Search Articles

Filter Articles

CRM Tech DocMan

Recent Articles

CRMCS Quick Start Guide: How To Produce a Microsoft Teams Live Event Dynamics 365 Marketing: Lead Scoring and Sales Acceptance Designing and Developing Microsoft Power Apps Portals Thank You for Attending CRMCS’ Webinar - Achieving B2B sales excellence with Dynamics 365 & Microsoft Teams Thank You for Attending Our Webinar - Achieving B2B sales excellence with Dynamics 365 & Microsoft Teams Webinar: Discover How CRMCS Have United Dynamics 365, SharePoint and Microsoft Teams To Create Sales Excellence Ignite your workflow by adding DocDrive365 to Office 365 The CRMCS guide to everything you need to know about integrating Teams with Dynamics 365 Saving Time By Keeping Documents In One Place TDE Database Encryption with On Premise Dynamics The Key to Successful Compliance in 2020 Part 2: Let’s get GDPR Compliant with Microsoft Power Automate Top 3 Essential Tips for Remote Working Dynamics 365 Marketing: Top 5 Best Features Dynamics Day in the Life - Puma Investments Can you use Teams to amplify collaboration in Dynamics? Part 1: Using a Scheduled Power Automate to Trigger Expiry Date Reminders The secrets of successful document collaboration in Dynamics CRMCS launches new AppSource approved DocDrive365 Dynamics Day in the Life - Moneypenny Release Management Add the App to Dynamics DocDrive365 Security: Day One - Getting Started with Dynamics to SharePoint Permissions Building a New Scheduled Process using Flow
  • "Paul has made a real difference to how my team of 24 people record and store valuable customer data and sales opportunities. Highly recommended."

    James, Operations Director

  • "Understanding your business allows us to advise when to implement aspects of CRM and, likewise, when not to."

    Paul McQuillan, Managing Director

  • "Dynamics 365 and CRMCS have made a real lasting difference to our business, allowing us to replace older systems that were holding back our performance."

    Grahame, Chief Operating Officer

  • "James worked well with us to help connect CRM with Outlook and relate how this might benefit our team using CRM for Property Care."

    Natalie, Property Care Supervisor

  • "Matt was really good with helping us run User Testing on the new Compliance Module of our CRM System."

    Tom, Compliance Administrator

Prefer to go old-school?

Write to us using the below addresses.

Head Office
CRM Consultancy
61 Oxford Street
Manchester
M1 6EQ

London Office
CRM Consultancy London
Grosvenor Avenue
London

Content © CRM Consultancy.