Build Logic App for Dynamics 365 CE to create a Task record when a Lead gets created
Azure Logic Apps is a cloud service that helps you schedule, automate, and orchestrate tasks, business processes, and workflows when you need to integrate apps, data, systems, and services across enterprises or organizations. Logic Apps simplifies how you design and build scalable solutions for app integration, data integration, system integration, enterprise application integration (EAI), and business-to-business (B2B) communication, whether in the cloud, on premises, or both.
For Dynamics 365 CE we can build Logic Apps as per requirement. Lets say we want to create a Task record automatically in Dynamics 365 CE when a Lead record gets created for lead followup purpose. For this requirement we can create Dynamics 365 Workflows also. But for this tutorial we will use Azure Logic Apps.
To start building the Logic App we need the following pre-requsites:
- Azure Subscription (you can avail trial version)
- Dynamics 365 Instance (you can avail trial version)
Lets see how to build the Logic app.
Step-1: Open Azure Portal and Search for Logic App
Login the Azure portal with your credentials and search for logic App to select the Logic App item from the dropdown list.
Step-2: Add new logic App and provide required information
Click on +Add button to add a new logic app and it will promt to provide some required informations.
Select Subscription, Resource Group (Create new or select existing), Provide Logic App name (name should not include spaces E.g.: Create_task_On_Lead_Create), Select region (of your choice), Log Analytics Off then click on Review + Create button. Once you click Review+Create button it will validate the details and enble Create button.
Step-3: Click Create button to create the App
After Create button clicked the app deployment process starts and after successful deployment it will show the below screen with Go to Resource button which on click will redirect to App Designer Page.
Step-4: Select Blank Logic App to start
In the logic App Designer, scroll down to find Blank Logic App option.
Step-5: Select Trigger
On clicking Blank logic App it will open the blank template designer. in the trigger search box type “dynamics 365”, it will show the Dynamics 365 opiton to select from drop down list. Select the item “Dynamics 365”.
On selection it will show some triggers related to Dynamics 365 entities. select “When a record is created”.
It may prompt to Login D365 Instance if so Login using the required credential. After Login it will prompt to select organization Name( select the dynamics 365 organization in which you want the App should run), Select Entity name( for now its Leads), Select interval (5) and Frequency(Minute) (This is to be selected as per the recurring logic requirement). for now our app will run every 5minute interval and check if any new Lead record created.
Step-6: Add Action
After the trigger is selected now its time to add Action. we can add Action by clicking +New Step button. It will prompt to select the actions as “Dynamics 365”.
Select “Dynamics 365” as Action and it will give related actions as per D365 entities actions. Select “Create a new record” from the list.
Now it will promt to select Organization Name, Entity name(for now its Tasks). In this step we can add requireed information against the fields of Task record by using “Dynamic Content”
After select org Name and Entity now click on Subject. it will open up the Dynamic content helper pop-up from where we can select required fields from the Lead entity record inputs as we have selected the trigger for Lead entity.
Select Topic from helper window, it will add to the Task record field. we can also add some static text like below “Followup-LogicAPP” so that when the record will create the subject of the Task will be “<Lead Topic> Followup-LogicApp”.
Select the Regarding field as Lead, Regarding Type as Leads and Owner as Created By. provide other informations if you want.
Step-7: Save the Logic APP
Now we can Save the App by clicking save button.
Step-8: Test the APP
Now the APP is scheduled as per our trigger and timeline but if you want to test the Logic App then click Run button and go to Dynamics 365 to create a Lead record.
To Test Create a Lead record in D365 application.
Go to Related Activities of the Lead you create after 5 minutes.
Check for the Activity Task created.
Click on the Activity record to see if the information we passed in Logic App all exist in the record.
Thats it. We have done our Logic App. Now explore other possibilities that a Logic App can do.