Logic Apps
Logic Apps helps you build, schedule, and automate processes as workflows so you can integrate apps, data, systems, and services across enterprises or organizations.To build integration solutions with logic apps, we can choose from a growing gallery of ~200 built-in connectors, such as Dynamics 365, SQL Database, Azure services (Azure Cosmos DB, Azure Table Service, etc.), Office 365, Salesforce, Google, and more. These connectors provide triggers, actions, or both for creating logic apps that securely access and process data in real time.
Benefits of using Azure Logic Apps:
- Out-of-the-box connectors reduce integration challenges
- Faster development using Logic App Templates
- Re-usability of the Logic Apps
- Pay only for what you use
Use Case
Today, we'll be looking at listing Dynamics 365 records, using Logic Apps, and then performing some processing on the data (sending email to retrieved accounts, storing contact email id in an Array Variable) and finally dumping the data on Azure Cosmos DB.
Here is my Dynamics 365 trial instance:
On a daily basic, I want to retrieve all the Account records which have Ownership as "Public". After retrieving the records, I want to send each one of them an Email about some changes to policies, and then finally I want to save the Accounts Email information in Azure Cosmos DB.
Currently, in my Dynamics 365 instance, I have 5 such records which are having Public Ownership. Hence we should get 5 emails from the Logic App, and 1 record in Azure Cosmos DB with Email information of all 5 Accounts in a serialized Array form.
Let's Develop the Logic App
This blog covers following sections in detail:
- List Dynamics 365 Records using Logic Apps
- Send Email from Logic App to the Accounts Retrieved from Dynamics 365
- Create a Document in Azure Cosmos DB from Azure Logic App
We will be developing the Logic App directly from the Azure Portal.
Now lets go over steps for each one of them:
Now lets go over steps for each one of them:
- List Dynamics 365 Records using Logic Apps
- Create a new Logic App Service in Azure Portal
- Select Recurrence from the Logic App Templates
- Initialize Variables - ContactEmail of type String, and ListOfContacts of type Array.
- Add a new Action, select type as Dynamics 365
- Select List Records from list of available operations under Dynamics 365.
- You will be prompted to log in to your Dynamics 365 organization. Provide your credentials and click on OK.
- Once you are logged in successfully, Select Organization Name and Entity Name from the dropdown as shown below. Also apply a filter criteria for selecting only Public Ownership Accounts.
- Add a new For Each loop from New Step
- In Output of previous step, select value from dynamics content popup.
NOTE - By default the For Each loop is designed to run in parallel, just like Parallel.ForEach in C#. If you wish to override this behavior, then go to options of the ForEach, and specify Concurrency options as mentioned below:
- Within For Each step, select Add Action.
- From list of available actions, select Set Variable, and set the previously initialized variable as shown below:
- Click on Save.
- Send Email from Logic App to the Accounts Retrieved from Dynamics 365
- Add a new Action - Select Outlook from list of available Actions
- Select Send an Email from list of operations available
- You will be prompted to specify your Outlook credentials. Once you enter your credentials, the Logic App will internally create a connection to your Outlook Account, and will utilize that connection to send emails.
- Then you would need to specify Email properties like To, Subject and Body.
- Click on Save.
Now our Step to send out Emails to each Account is also set up. Next we will look into saving Accounts data in Azure Cosmos DB.
- Create a Document in Azure Cosmos DB from Azure Logic App
- Just below to the previous For Each Step, Add a new Action, and select Cosmos DB From available Connectors.
- Select Create or Update Document from listed Actions.
- Select the Azure Cosmos DB account listed below, and give a friendly name to this Connection. Then Click on Create.
- Select Database ID, Collection ID from the dropdown, and specify a JSON message in Document section as shown below:
- Click on Save.
Run the Logic App
Even though we have set the trigger interval for Logic App as 1 Day, for testing purposes, we can directly Run the Logic App from the Azure portal. So when we run the Logic App that we just developed, we can see the execution results in a neat flow on the Azure Portal, with Pass/Fail results for each step of the Logic App.
Clearly we can see from the image above that All our steps were executed successfully.
Now lets check the output one by one. First we will check the emails (For testing purpose, I have sent all the mails to my mail ID), below is an image showing 5 mails that I have juts received from the Logic App:
Also, here is an image of the Document that is just created in Azure Cosmos DB account from the Logic App:
References:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-overview
https://azure.microsoft.com/en-in/services/logic-apps/
Very useful information, Keep Update with us Azure Online Training
ReplyDeleteAzure app meet rigorous performance, scalability, security and compliance requirements while using a fully managed platform to perform infrastructure maintenance. Quickly create powerful cloud apps using a fully managed platform from Impiger technologies. Impiger provides amazing service.
ReplyDeletethis is very usefull for everyone Azure Training in Chennai | Certification | Azure Online Training Course | Azure Training in Bangalore | Certification | Azure Online Training Course | Azure Training in Hyderabad | Certification | Azure Online Training Course | Azure Training in Pune | Certification | Azure Online Training Course | Azure Training | microsoft azure certification | Azure Online Training Course
ReplyDeleteTHIS INFORMATION IS VERY NICE
ReplyDeleteAzure Training in Chennai | Certification | Azure Online Training Course | Azure Training in Bangalore | Certification | Azure Online Training Course | Azure Training in Hyderabad | Certification | Azure Online Training Course | Azure Training in Pune | Certification | Azure Online Training Course | Azure Training | microsoft azure certification | Azure Online Training Course
Thank you for sharing such great information very useful to us. This is good information and really helpful for the people who need information about this Thank you for sharing any good knowledge and thanks for fantastic efforts. Good information. Thanks for sharing with us
ReplyDeleteoracle training in chennai
oracle training institute in chennai
oracle training in bangalore
oracle training in hyderabad
oracle training
hadoop training in chennai
hadoop training in bangalore