Tuesday, 7 November 2017

Analyse SQL performance issues using SQL Query Store for D365FO

Someone at work showed me this. With the production environment the Query Store is enabled. So when you bring it back to a sandbox environment. All that information comes with it.

If you connect to the database via SQL management studio. Then navigate to the Query Store. There is a lot of great in depth information you could get. I have a customer that has gone live for 3 months and I wanted to see if there were any improvements we could do. Such as missing indexes we could add to our product.

image

I won’t dive in too deep as there are some great resources online on how to utilise Query Store.

I should mention a lot of this information shows up summerised on LCS. So that should be your starting point but I am really glad this is available.

Friday, 27 October 2017

Chain of Command–next() gotcha

UPDATE: 31/10/2017

Microsoft reached out and I have to correct my example code. It seems the compiler does not catch it when it is 2 nested conditions. See below code.



Be careful when using Chain of Command not to place the next() call in a condition.

Here is an example.

Create a class extension for a form. Call the method init() but place it in an “if” condition. Something like this.

 [ExtensionOf(formStr(PurchReqCreate))]  
 final class PurchReqCreate_EAM_Extension  
 {  
   public void init()  
   {  
     info("Outer - Before next");  
     if (this.args() &&  
       this.args().record() &&  
       this.args().record().TableId == -100) //intentionally made it -100 to not execute this code  
     {    
       //doing something here  
       info("Inner - Before next");  
       if (this.args().record().TableId == -100)   
       {  
         info("Inside second if condition");  
       }  
       next init();  
       info("Inner - After next");  
     }  
     info("Outer - After next");  
   }  
 }  


The compiler will not error or give you a warning. However, at run time you will get a misleading error.

In my case I got this. “Error executing code: Wrong argument type for function.”

image

Having a look at Event viewer (Folder: AX-XppRuntime), it gave me a little more info. At least I know the class that was calling it. I searched for any customization.

image

I found an extension class PurchReqCreate_Extension. I was able to eye ball and figure out the problem. Taking next() outside the “if” condition.

Rewrote the same:

public void init()
{
  if (this.args() && this.args().record())
  {
    //
do something before
  }

  next init();

  if (this.args() && this.args().record())
  {
    //
do something after
  }

}

Sunday, 1 October 2017

First look at Azure Functions

Azure Functions allows you to write code that can be triggered by an event or timer. You don’t need a machine to run it on. All the computing runs on the Azure cloud ie sevrverless computing.

Below is a quick walk through. Keep in mind Microsoft has great documentation on their site. Just google it.

In this post I will put a simple walkthrough. Save you from the information overload.


Make sure you are using Visual Studio 2017.

Create a project of type “Azure Function”

image

Give it a minute to resolve the NuGet package. You will see a warning icon and watch it disappear by it self.

image

Once its done. Right click and Add item.

Select the type of function. The easiest to do is the Http trigger.

image

This will create a class with some sample code.

image

When you run it, it will run a local instance.

image

Navigate to the URL and watch it run.

image

There are many applications in the Dynamics space. Hopefully next time I can cover some Dynamics scenarios.

Monday, 25 September 2017

Technical dive into the Mobile Platform in Update 10

With the recent Platform update 10 they introduced server side coding and made some enhancements to the mobile platform. This brings a lot of flexibility and capabilities. Below I will focus on just the Expense Management Mobile workspace.

For one, the Mobile workspaces are now embedded in the AOT as a resource file. Notice how it says “In metadata”. This indicates that it has loaded from the AOT. I think this is a good move. Its all about ALM. This is also great to keep the server side and client side in sync.

image

The nice thing is that the Expense Mobile solution is in its own model. Makes it easy for us to track and learn from.

The main entry is the workspace resource file xml. Notice the guid, this is important for doing some server side coding.

image

Now lets take a look at the workspace class. You will notice the same guid is used for the class attribute.

image

in one of my prior posts, I mentioned that the currency field wasn’t being defaulted when entering a new expense. Now with server side coding you can achieve some of these things.

Below is a default config contract class. It is triggered from the above class. You can add as many contract classes as you like. See line 20 and 21 in the above screenshot.

image

If you look at the js file embedded in the workspace xml. You will notice that it loads the config contract onto the client side. Allowing it to work client side and not requiring a connection to the server.

image

The other things you will notice is that there are a number of forms created just for the mobile solution. Below are screenshots of the whole model. Its not that big but there has been substantial work done to get to this point.

Below are some screenshot for my own reference. I know I will refer to to it in the future.

image

image

image

image

Refer to Mobile Platform landing page for more information.

https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/mobile-apps/platform/mobile-platform-home-page

Friday, 8 September 2017

Azure AD Authentication for Windows Applications

In this post I will describe how you can get the login dialog to pop up when you are developing a windows desktop application.

Below is an example of the dialog appearing.

image

Below is a sample code how to acquire the token.

string authorityUri = "https://login.windows.net/common/oauth2/authorize";
Uri redirectURI = new Uri("https://login.live.com/oauth20_desktop.srf");                

AuthenticationContext authenticationContext = new AuthenticationContext(authorityUri);

AuthenticationResult authenticationResult = authenticationContext.AcquireTokenAsync(
   ClientConfig.Default.ActiveDirectoryResource, 
   ClientConfig.Default.ActiveDirectoryClientAppId, 
   redirectURI, 
   new PlatformParameters(PromptBehavior.RefreshSession)).Result;

Add the redirect URI for https://login.live.com/oauth20_desktop.srf

image


Reference: https://docs.microsoft.com/en-us/rest/api/datacatalog/authenticate-a-client-app

Thursday, 31 August 2017

Table casting in AX 2012 and D365O

D365O is a lot more sensitive about casting or should I say AX2012 was too relaxed about it. This post is to show a specific scenario that works differently in the new version of the product.

We had a bit of code that worked fine in AX2012 but stopped working in D365O. After debugging we found that when you cast a table it took the tableId of the cast.

Below is an example of AX2012 vs D365O:

image

image

UPDATE – Thanks for Joris for pointing this out.

Same code running in CIL in AX2012. The piece of code in question was running client side. Otherwise, I would have noticed this in AX2012 too.

image

Wednesday, 23 August 2017

Daxeam Mobile Solution Released on Apple App Store and Google Play Store

I am very happy to say Daxeam Mobile is now available on Apple App store and Google Play Store. Daxeam Mobile fully working on both Dynamics 2012 and Dynamics 365 for Finance and Operations, Enterprise Edition.

imageimage

Daxeam is an Enterprise Asset Management (EAM) solution available exclusively for Microsoft Dynamics AX 2012 and Dynamics 365 for Finance and Operations, Enterprise Edition. The Daxeam solution extends the functionality of AX, delivering integration to EAM across Projects, Inventory, Finance and Fixed Assets.

Some key items to note about the Mobile solution:

  • Daxeam Mobile is an application built from the ground up to work with the Daxeam
  • Login is managed security via Azure Active Directory
  • Works for both AX2012 and D365O
  • Offline capable – has sophisticated sync capabilities to download your data locally and syncs back up when connection is available
  • Features available
    • Asset hierarchy
    • Asset management such as meter updates, view attributes, structures and related history
    • Work order management such as creating, editing, status updates, registering hours, registering items, executing your checks and many more
    • Observation management such as creating, editing
    • Taking pictures
    • Searching and Barcode scanning

image