Friday, 16 September 2016

Azure Logic with AX–callable endpoint

There are lots of ways to work with Azure Logic. This will be my first of many hopefully to show you how you can use Azure Logic with AX.

Have a read of this post from the Azure Logic team first. It explains how you can create a callable endpoint in Azure Logic.

Logic apps as callable endpoints

In my post I will show you how you can use AX to call an Azure Logic endpoint.

SNAGHTML2b98aec (I am not a graphics guy but the little fire on the end of the rocket is my addition)

First start by writing a job that sends a post message to request bin. Request bin is a good site which you can use to send a message to it and it displays the results in a readable way.

Navigate to request bin and copy the URL into the job. Then run the job to see the result.

static void _jsonJob(Args _args)
{
    RetailWebRequest    request;
    RetailWebResponse   response;
    str                 rawResponse;
    Map                 data;
    RetailCommonWebAPI  webApi = RetailCommonWebAPI::construct();

    str _requestUrl = @'http://requestb.in/1a07xyj1';
    //str _requestUrl = @'https://prod-02.northcentralus.logic.azure.com:443/workflows/bb7f4b0c834f418cbf7d2fa969c4bcea/triggers/manual/run?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=AAAAAAAAAAAAAAAAAAAAA;
    str _postData =
    @'
    {
            "email": "munib@fakeemail.com",
            "name": "Munib A Ahmed"
    }
    ';
    str _header = '';
    str _contentType = 'application/json';

    response = webApi.makePostRequest(_requestUrl, _postData, _header, _contentType);

    rawResponse = response.parmData();
    data = RetailCommonWebAPI::getMapFromJsonString(rawResponse);
    info(rawResponse);
}

Below is what you should see in request bin.

image

Now, lets do it via Azure Logic.

1) In Azure Logic create a new app

image

 

 

3) Create a HTTP request. This will give you a URL which you can call.

image

Use http://jsonschema.net/ to copy your message and get a schema. This schema can be pasted into the HTTP request.

image

I create an action to send an custom response. I added parts of my request and some additional elements.

Run the job in AX and have a look at the response.

image

This is just a quick test but think of similar examples. You can possibly create a framework in AX where you send a message after an invoice is posted. That message could be json, string, xml or filestream. Then you can have Azure Logic send an SMS, email, integrate with SalesForce/CRM or all other connectors.

Wednesday, 14 September 2016

Azure AD in new Portal

The #AzureAD admin experience in the new Azure portal is now in public preview!

I thought I would give it a try out with the AX7 by registring the native application on Azure AD.

See wiki and search half way in the page for Register a native application with AAD

https://ax.help.dynamics.com/en/wiki/dynamics-ax-7-services-technical-concepts-guide/

Navigate to the Azure AD in the new Portal. Click on App registrations.

image

Create a Native App and enter a Redirect URI.

image

Click on the Required permissions and select Microsoft Dynamics ERP. Then select the 3 delegated permissions.

image

Should look like this at the end.

image

Friday, 9 September 2016

Exchange rate providers using OANDA

This was done for a number of customers but it is good to see it standard in AX7.

Friday spotlight goes to …

image

Until next time. I have some exciting blog post ideas but trying to find the time.

Friday, 2 September 2016

Additional posting layer in journal names [AX7]

This was a nice find the other day. AX7 has introduced additional posting layers to the enum. This is great for financial reporting. It might seem like a small thing but the fact that it flows through to the GL entries and also MR recognizes it, is a great thing. Make sure to get the latest MR for it to work.

2016-06-30_15-35-31

Thursday, 18 August 2016

Create a new partition [AX 7]

This is a deprecated feature but still works for simple testing. I used it mainly to test importing of configurations in a new clean environment.

To create a new partition, you must put the form name at the end of the URL.

https://usnconeboxax1aos.cloud.onebox.dynamics.com/?f=partitionadministration

image

Create a new one and save it.

To login to the partition, you must do a similar URL parameter by adding the partition name.

https://usnconeboxax1aos.cloud.onebox.dynamics.com/?prt=newPartition

Note, that the partition have their own data through out. Companies and security must be set up individually.

Reference: https://community.dynamics.com/ax/f/33/t/198960

Sunday, 17 July 2016

Tax calculation on Net amount - Gotcha

In AX you have various ways of calculating tax. The one that is most confusing is calculating on the Net amount.  I thought I would show a few examples where you can get caught on this.

Notice below an example with negative lines. See how the distribution looks wrong but it is right. It distributes the rounded tax amount based on the total of the invoice.

2016-07-17_10-03-25

Another simpler example where the total of the invoice is zero. There is no tax calculated.

2016-07-17_9-56-57

There a few things you should consider when choosing this method.

  1. Do not add the Tax amount column on the Invoice report. This can make people say it is calculating incorrectly and you having to explain this problem. Standard AX does not have the tax amount column for this reason.
  2. If you are integrating with another system, make sure your method of calculating tax is the same. For example, if you are integrating an ecommerce web site with orders.

Download the excel file for a working example. Follow the instructions and enter your own values in the yellow cells. It will calculate based on the total, rounded to two decimal places.

xlsx

Note there are other methods of tax calculating, including line based.

Note: GST is Goods and Services Tax in Australia. It is set at a flat rate of 10%.

You can change the tax percentage in the file.

Friday, 17 June 2016

Tip of the day: Set up one environment at a time on LCS

When setting up new environments on LCS, always try to set up one at a time. This is so that you have a bit more control over your environments.

Here below I have set up a Developer and a Build VM in one shot. You will notice the controls to start and stop the images are for both VMs.

2016-06-15_0645