Filter OData entity by enum field.

As you may know, logic apps do not have any triggers available for Dynamics365 for Operations. So we have to use recurrence trigger to read data periodically from a data entity and obviously we want to filter a query. This is pretty straightforward with string or integer fields, but not with enums.  Under the hood AX enums are enumeration in OData.

For example, I have new entity “RentalInvoices” and I want to filter it by AXCRMTransferStatus field and select only “pending” records.

Designer view:

LogicAppODataFilterDesignerView.png

Code view:

LogicAppODataFilterCodeView.png

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!