Logic Apps – A Serverless Solution to build “Smart” Workflows

Logic Apps are a smart and effortless way to build Workflows in the Cloud. They act like pipelines with stacked actions, connecting data saved in silos using connectors.

In this blog, I have explained about workflows, serverless solutions and how Logic Apps can be used to integrate data between #Dynamics 365 and #Office 365.

What are Workflows?

Organizations have their own unique ways of doing things, and they are called as Business Processes. They maintain a sequence in which these processes are carried out, described as Workflows. A workflow could be as simple as an approval workflow or it could involve moving data from one source occurring on an event or trigger, massaging it and routing to destination source.  It could even be complex workflows involving multiple data stores and multiple actions to be taken.

Whether easy or complex, every workflow has a few characteristics:

  • Something must start or trigger a workflow or it can also be scheduled to happen at a regular interval.
  • A workflow can have several steps running sequentially or in parallel.
  • A Step may involve evaluating a condition which progresses the workflow to next logical step. (#Control Flow and #Conditions)
  • A step may need to make connections to Data Sources. (#Connectors)
  • Every step needs to do an Action such as sending notifications, setting values for the workflow variables, etc.(#Action)
  • A workflow can end after traversing its flow or it could be a long running workflow.

 

In the world of Software Engineering, a pictorial representation of logic called a ‘Flowchart’ can be compared to a workflow. Or, if you have used SharePoint Workflows before, then Logic Apps are going to be in-cloud replacement for that.

Since all or most of the businesses need some kind of Workflow, giving in to its popularity and demand, Microsoft has provided an engine for building Workflows using existing components that can act as Connectors and Actions. So, instead of having integration experts and developers do the Workflows, Microsoft has brought this arena to Add-Hoc or Citizen users. Mission-critical, complex integration can now be built using enterprise level components with little or no coding. However, if customization is needed then Logic Apps has got extension points. Let’s look at the official description of Logic Apps.

Serverless Solution

“Serverless” is a misnomer, it does not mean there is no server involved in running Logic Apps. What it really means it that “Server” is abstracted out for a user. A user need to only provide “what needs to be run”, and cloud will take care of the part “How it is run?”. This means we don’t need to worry about platform, operational management for scaling up and down, or getting latest updates, etc., since the infrastructure is hosted in a cloud. We don’t need to worry how the solution is hosted, and if it is going to be available and scalable. So, Serverless means Reduced devops, which also reduces the time to market, as we only need to worry about the core logic. It is also cost effective as users pay per action, i.e. only when a Logic App is called or used.

 

What are Logic Apps?

Logic Apps is a serverless Workflow execution engine in Azure cloud. They act like pipelines with stacked actions, connecting data saved in silos using connectors. Here are some key factors that make Logic Apps easy to use and implement.

  • Logic Apps can be created using a Web based designer in Azure Portal. No installation is required. Alternatively, you can also use Visual Studio.
  • There are over 150+ existing connectors that can be used to make connections and integrate data. And it is also fairly easy to build your own connector if it is missing, as connectors are nothing but REST APIs .
  • Logic Apps can connect to Dynamics 365, Office 365, SQL in Azure.
  • Logic Apps can also connect to om-premise data such as SharePoint, SQL
  • Logic Apps can make smart connections to API’s hosted in Azure or using Microsoft cognitive services.
  • Logic Apps can call into Azure Functions to execute a snippet of code on-demand.
  • There is a collection of pre-built templates that allow users to rapidly build some common solutions.
  • Logic Apps can connect to a Topic or Subscription on an Azure Service Bus to pick a message and perform an action on it.
  • Logic Apps are built on the following key concepts
  1. Managed Connectors

They act like a passage in the pipeline. They provide a flow or direction to the data. Connectors get data from source and then take it to the destination.

  1. Triggers

They are events on which the Workflow instance is started, e.g. when a new item is created in Dynamics 365, or when an email is received.

  1. Actions

Actions are steps that are carried out after a trigger is executed.

Build a Sample Logic App

Let us create a simple Logic App that would watch Dynamics 365 and send an email to Office 365 when a new Contact is created.

Log in to the Azure Portal, sign up with Azure to get your first month free. If you have MSDN subscription then you get $150 credit every month for free and your account gets disabled when that credit is used up so you won’t be charged without your consent.

Inside Azure portal, select ‘App Services’ and pick Logic App

Enter a name for your Logic App, and enter a Resource Group. Resource Groups helps is keeping connections and stuff together so that Apps can share amongst them.

A Logic App is called when a trigger happens or it can be scheduled to run at an interval. Next screen will let you pick a trigger from existing list of Triggers. Pick ‘Blank Logic App’ for this sample.

Logic App designer will pop up a look up screen where you can enter a keyword to short list what you are looking for, or just browse through a collection on options in the form of Triggers and Actions. Pick the one for Dynamics 365 – When a record is created.

Next, we are required to connect to Dynamics 365, but picking the Organization name that our login has access to. Connection can be changed at any time by clicking ‘Change Connection’ link.

Pick the Entity as ‘Contacts’ and set a frequency to check for updates.

Our first step is now completed. To create the next step, we have options to pick from, whether the next step is going to be an action or a condition or a loop. For this example, we will pick ‘Action’

Various actions are already available and the list is continuously growing. Pick ‘Send an Email using Outlook 365’. Enter details such as To, Subject and Body. We can enter Dynamic content that is made available from previous step. Here I have used FirstName and LastName in the body of the email. We can add another step here but for simplicity, save the Workflow and run it.

Inside Dynamics 365, create a new Contact by entering details. This will execute the trigger in our Workflow.

As the workflow advances, the action of sending an email will be performed. Watch for the email in Office 365 Inbox.

 

And this is how we can easily create a Workflow between Dynamics 365 and Office 365. Using existing connectors and actions, it is possible to build different workflows without writing a single line of code. And they are also provisioned to let developers write custom logic that integrates easily with Logic Apps. No wonder they are referred to as Big Brother of Microsoft Flow.

Share this post

Related Posts

Checking Your CMMC Progress

Written by Alec Toloczko With Cybersecurity Maturity Model Certification (CMMC) requirements on the horizon, it’s crucial for organizations handling Controlled Unclassified Information (CUI) to adhere

Read More »