AX 7. Azure Logic Apps, CDM and PowerApps. Part 2.

In previous blog post we built simple scenario where we created customer in AX from external web request using Azure Logic App.

This time I am going to extend Logic App that was created before to support Common Data Model (CDM). There are couple of APIs that we can use:

cdmapis

In this case, I want to create a new record in CDM every time when a customer is created in AX.

We can achieve this simply by adding new API to our App and mapping the fields. I used “Customer” entity from CDM, which comes out of the box with CDM database.

logicappcdm

After request is sent and customer is created, we have two options to check it in CDM: view records using Excel add-in or build new PowerApp.

Option 1: Go to powerapps.microsoft.com, find your entity and open it in Excel.

Excel Add-in supports all features that we like in AX 7, so you can create, update and delete records with it.

CDMExcelAddin.jpg

Option 2: Create from powerapps.microsoft.com new app in PowerApps Studio for Windows or PowerApps Studio for Web.  I personally prefer desktop version, because it works faster for me.

powerappsstudio

From PowerApps studio you can create new App for CDM, CRM or even for AX. When you create new CDM App you need to specify connection to database and select entity, same as above we will select “Customers”.

After that studio will automatically generate an App for us.

powerappsdesigner

By default, new App has 3 screens: Browse, Details and Edit.

We will modify the layout and delete non relevant fields. So instead of Fax, Phone and Address we will put Customer Id and Description on Browse screen and add contact information to Details screen.

PowerAppsScreens.jpg

That’s all, now we can run the App and see what we’ve got.

powerappsbrowsescreen

powerappsdetailsscreen

Nice and simple way to build new App to work with customers without even a line of code!

Advertisements

AX 7. Azure Logic Apps, CDM and PowerApps. Part 1.

We are all exited with Dynamics365 coming. As we know, it is based on PowerApps, Common Data Model and Flow. Finally, we can put all these features together with connector to AX online which is released recently (https://flow.microsoft.com/en-us/blog/more-september-updates/).

Today, I will show how Azure Logic Apps can be used in integration scenarios. For example, we want to create a new customer in AX from an external web service. In previous versions it was non-trivial task, but now it could be done in couple of clicks!

First of all, we need to create a new Logic App. We can do this either from Visual Studio or directly from Azure portal.

This app will receive requests from external web services and to handle this we will add HTTP request trigger that accepts JSON.

httprequestrigger

To build JSON schema you can use one of dozens online services. Here is example from one of them:

jsonshemabuild

As you can see, my request contains AccountNum, DataAreaId, CurrencyCode, CustomerGroupId, name and AddressCountryRegionId fields.

On the next step we will add Dynamics AX connector that uses values from JSON request to create new customer. After specifying connection to AX 7, you can select any OData entity from drop down list and it will automatically add all mandatory fields. Each filed you can map with value from JSON simply selecting them from a list.

dynamicsaxconnection

That’s all, save it and we can start testing.

To send the request I used Postman, but in real life scenario it would be a web service.

postman

Voila! New customer has been created in AX.

newcustomer

On Azure portal you can track execution status and debug into each step, where you can see all data that was sent.

execution-status

execution-status

What’s next? You can add a response to notify web service if record was successfully created, send email with confirmation or even SMS.

In my next post I’m going to look at CDM and PowerApps, stay tuned!