Monday, May 15, 2017

Dynamics 365 key shortcuts

If you are fan of using the keyboard when working with D365 for Operations then you might want to know about pressing the CTRL + ‘ to perform an action. Yes that is the single quote or apostrophe symbol. It’s a little hard to see on the label when you hover over the magnifying glass.
What this allows you to do is type in a menu item for the form that you are on. This is handy if you are on for example the customer record and want to see the customer balances you can just type balances in the perform and action box and press enter to open that form. This is handy if you don’t want to take you hands off the keyboard to pick up the mouse.
You can find the details on Microsoft document site.

Thursday, April 6, 2017

Batch script for deleting AUC and KTI files

This post contains a small batch script which deletes all *.auc and *.kti files normally requires when you are willing to clear user caches.

Save this below script in a file and save it as *.bat extension. Execute this file and it will deletes *.auc and *.kti files.

@echo off
cls
setlocal
:PROMPT
SET /P AREYOUSURE=Delete AX User Cache (Y/[N])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO END

CD %Userprofile%\AppData\Local
Del *.AUC
Del *.KTI

:END
endlocal
Pause

Tuesday, April 4, 2017

Print Management Dialog X++

Sometimes you might need to open up print dialog using X++ code to let user choose what print medium to be used for printing.

This post shows a code sample where sales invoice report is printed using X++ code but before printing Print Management dialog is prompted to choose destination for print as shown below.

Thursday, March 23, 2017

Independent transaction in AX

Sometimes we need to write some data into a database independently on the currently running DB transaction. For example, we want to log some state occurred in the application, however any exception could cause a rollback of the whole transaction, including the log entry. It could look as follows:
LogTable logTable;
;
ttsbegin;
logTable.Message = "Something happens";
logTable.insert();
//some following code in the same transaction throws an exception
throw Exception::Error;
ttscommit;

It can be resolved quite easily. We need to create a separate database connection and possibly our own transaction. The modification of the preceding code would look as follows:

LogTable logTable;
UserConnection connection = new UserConnection();
;
ttsbegin;
//use another connection
logTable.setConnection(connection);
//beginning of the independent transaction
logTable.ttsbegin();
logTable.Message = "Something happens";
logTable.insert();
logTable.ttscommit();
//this exception doesn't affect the logTable entry
throw Exception::Error;
ttscommit;

Thursday, March 9, 2017

Microsoft Dynamics AX Retail

In this post we will highlight components of Dynamics AX Retail. Dynamics AX Retail architecture are divided into two main categories named as Headquarters and Store as shown below.




Let's discuss these categories and their components in details.

Headquarters


Besides having AX essentials components such as Client, AOS, Enterprise Portal and AX Database we have Real-time service and Async Server with message database. The Retail Headquarters component installs runtime components that are required to enable key aspects of Retail functionality, such as the screen layout designer. This component must be installed on the Application Object Server (AOS) computer and on Microsoft Dynamics AX client computers.

Wednesday, March 8, 2017

Combine XPO Tool

The Microsoft Dynamics AX 2012 Combine XPO Tool is a command line program that combines a set of interdependent XPO files into a single XPO. For example, if a team of developers is making code changes to different aspects of an application, they can use this tool to merge those changed files into one XPO file.
As of AX 2012 R2, the Combine XPO Tool is available in the Microsoft Dynamics AX\60\Management Utilities folder. (The beta version of the tool was previously available on InformationSource).

Demonstration

For demonstration purposes I have created two XPO's XPO1 and XPO2 respectively and the output will be a merged XPO containing objects in XPO's file.

XPO 1
XPO 2

The Combine XPO tool generates an XPO file that is a combination of the XPO files in a given folder and any subfolders. It takes the path to the folder and the name of the resulting XPO file as input. For example, if you have XPO files in the C:\MyApplication\ModelA folder, you would use the following commands to create the combined XPO file:
CombineXPOs.exe -XpoDir c:\MyApplication\ModelA -CombinedXpoFile c:\MyApplication\AXModelAFiles.xpo

Results

Merged XPO


Thursday, February 23, 2017

Dynamics AX 2009 Menu Traverser

In order to identify how many time a specific menu item, is being used and at which locations with respect to navigation of Dynamics AX Rich Client. Since there is no out of the box functionality beside having cross references, so I get the idea from https://community.dynamics.com/ax/b/microsoftdynamicsaxextensions/archive/2016/06/03/dynamics-ax-2012-menu-traverser post.

The only issue is that the above post only targets Display menu item in AX 2012, however in this blog post I will target for all types of menu items for Dynamics AX 2009.


You can download XPO from here.

Thursday, February 16, 2017

How to Open Visual Studio with a Specific Configuration [AX 2012]

You can configure Visual Studio to open with a specific Microsoft Dynamics AX client configuration. This causes Application Explorer to point to the designated configuration.

To open a specific configuration, you use the /AxConfig switch with a parameter of either a configuration name or the path and file name of a configuration file (.axc file). If your configuration name or configuration file name contains spaces, be sure to enclose the parameter in quotes. If no parameter is specified, then the default configuration is used.

"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /AxConfig ContosoDev
or
"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /AxConfig "z:\Config\ContosoDev.axc"

Wednesday, February 15, 2017

Uses of Cortana Intelligence Suite AX 2012 R3

Here are some of the most common scenarios that can use this integration:

Customer service integration –
The Recommendations API integration can be used to provide product recommendations for customers who interact with a call center agent to place catalog orders. At the point of interaction, the call center agent can both upsell and cross-sell items that might be of interest to the user. Note that a mix of recommended items can be included, based on builds of both the FBT and Recommendations build types, to provide meaningful upsell capabilities.

Recommendations in a Microsoft Dynamics AX for Retail online store – In AX 2012 R3, the Retail online store or the Retail online sample store can be extended to use product recommendations. The online sample store is preconfigured to include recommendations-related controls in the Products/Item view. By default, these recommendations currently use the related items for a product and are based on the static configuration when a new product is added to the retail catalog. To use the Recommendations API, you can use custom logic to extend the Generate related products (RetailRelatedProductsJob) batch job that currently computes the various categories of recommendations. Even if you do not use the Retail online store, you can take advantage of a
customization of this type, provided that the Retail channel database is being consumed by your e-commerce front end.

Recommendations in an online store that is based on another e-commerce platform – The Cortana Intelligence services management module is not dependent on Microsoft Dynamics AX for Retail. You can use this module even if you have an online e-commerce site (custom or from another e-commerce vendor). Therefore, you can keep Microsoft Dynamics AX as the system that all other integrations point to. In this way, you can help guarantee that business logic always go through your enterprise resource planning (ERP) application.

Recommendations in emails – The Recommendations API integration can also help you with the challenge of recommend products to users. These recommendations, which are often sent by email, aggregate the history of the user’s purchase and also use the items that are purchased by similar customers. Because you can create and use rich HTML-based email templates in AX 2012 R3, and can also configure those templates so that they are used in a batch-based server setup, you can build a rich scenario around this use case. You can even segment this issue based on customers (top x percent or bottom x percent) and items (place cold items).

Cortana Intelligence Microsoft Dynamics AX 2012 R3

It is a really amazing feature introduced in Microsoft Dynamics AX 2012 R3 CU 12 release which enable integration between Microsoft Cognitive services and Dynamics AX. Like any other Machine learning model this model follow Supervised Learning concepts where you train the learning engine before expecting any predictions.

Let's shed some light on some of the terminologies:


Cortana Intelligence suite

Microsoft Cortana intelligence suite is a collection of technologies for information management, big data storage, machine learning and analytics and data visualizations. Cortana assistant on Windows 10, Chabot made with Bot framework, Cognitive services and many other applications utilize one or many technologies marketed under the brand of Cortana intelligence. 

Microsoft Cognitive services

The Microsoft Cognitive Services APIs are a suite of several general-purpose Machine Learning APIs that are made available in Microsoft Azure and can be used for any number of applications. These APIs simplify the whole process by abstracting away the complex machine learning models and the operationalization aspects so that users can focus on real business problems. There are several categories of Machine Learning APIs and the Knowledge category includes the Recommendations API.


Recommendation API

The Recommendations API exposes a general-purpose recommender system capability that is wrapped in an easy-to-use representational state transfer (REST) API. Our goal is to enable several business processes that involve customer recommendations to use this functionality.

The following illustration shows the steps in the process of consuming recommendations by using the capabilities in AX 2012 R3. 


Detailed steps and configuration can be found in White paper :

Tuesday, February 14, 2017

Build number in Microsoft Dynamics 365 Operation / AX 7

In order to find out build number in Dynamics 365 for Operation / AX 7. Click on Setting menu on the top and select About.


A new form will appear containing Platform version.


Monday, February 13, 2017

Microsoft Dynamics 365 Overview

RE-INDEX versus REORGANIZE

In order to reduce fragmentation on indexes, you have two options. You can REORGANIZE an index, or you can REBUILD the index.
When you REORGANIZE an index, the leaf level will be reorganized, and the index is kept online during this operation. The advantage to this is that table locks are not held, and queries can continue as normal.

When you REBUILD an index the default is to take the index offline. What this means is that a table lock is held, and all reads and writes that utilize the index are blocked until the REBUILD is complete. This can cause blocking and poor performance of queries.

Dynamics AX Database Maintenance Strategies

The recommended strategy is to REORGANIZE indexes below a certain fragmentation threshold, and REBUILD those above that same threshold on a daily basis. See the script at the end for how to accomplish this. The fragmentation threshold that you choose can vary the amount of time that your maintenance job takes to complete, and should be monitored to make sure that it is not running into business hours. 

Record Info in AX 7 / Dynamics 365 Operations

In order to view Record info in AX 7 / Dynamics 365 Operations. Select a record and select options form the top.


New Action Pane menu will appear and from there select Record info.



Difference between " and ‘ ? in Dynamics AX

This is one of the most common question which floats around AX developers and Technical consultants. The answer is very simple: X++ makes absolutely no distinction between the two.

The application community has best practices that mandate that programmers use ‘(single quotes) for text that cannot appear on UI, like

System.Int32 myVar = CLRInterop::CLRNull('System.Int32');


Whilst text that does should use double quotes for text like

myButton.Label = "@SYS12345";

Clearing usage data in AX 7 / Dynamics 365 Operations

In order to clean usage data in AX 7 / Dynamics 365 Operations all you need to do is to go under Settings button on the top right and select Options



Under Option select Usage data on the top 



Now click on Reset button at the bottom


Hit Yes when prompted




Thursday, February 9, 2017

Free Text Invoices AX 2012

As we know the most common way of billing customer is using sales orders in AX. A sales order is created against customer for items or services being sold followed by appropriate steps of Confirmation, Picking, Packing and Invoice. 

Free text invoice is an invoice which is not linked to any sales order. You cannot provide item number on lines here unlike sales order, it is used in such cases when sales do not requires a sales order, packing slip and customer invoice. 

USES

Free text invoice can be used for service fee or consulting fee or miscellaneous fee for any kind of reimbursement.

Wednesday, February 8, 2017

Types of Sales Orders in Dynamics AX 2012

In this blog post, we will look into different sales order types present in AX 2012. When a sales order is created, AX allows you to choose among the following three sales order types:
  • Journal 
  • Subscription
  • Sales order
There are other two types of sales order which are created through return order management or project management. 
  • Return order
  • Item requirement

Default sales order type

AX provides you an option to choose a default type for every new sales order created in system. You can provide the default order type under:

Accounts Receivable Parameter -> General ->  Sales -> Default Value -> Order type


Let's shed some light on the types of sales orders here.

Monday, February 6, 2017

Size of all tables in database

In order to identify size and number of records in table following options can be used :

  • Query
    • Use the following query to identify the size of tables

SELECT 
    t.NAME AS TableName,
    s.Name AS SchemaName,
    p.rows AS RowCounts,
    ((SUM(a.total_pages) * 8) / 1024) AS TotalSpaceMB, 
    (((SUM(a.total_pages) * 8) / 1024) / 1024) AS TotalSpaceGB, 
    ((SUM(a.used_pages) * 8) / 1024) AS UsedSpaceMB, 
    (((SUM(a.total_pages) - SUM(a.used_pages)) * 8) / 1024) AS UnusedSpaceMB
FROM 
    sys.tables t
INNER JOIN      
    sys.indexes i ON t.OBJECT_ID = i.OBJECT_ID 
INNER JOIN 
    sys.partitionsON i.OBJECT_ID = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN 
    sys.allocation_unitsON p.partition_id = a.container_id
LEFT OUTER JOIN 
    sys.schemas s ON t.schema_id = s.schema_id
WHERE 
    t.NAME NOT LIKE 'dt%' 
    AND t.is_ms_shipped = 0
    AND i.OBJECT_ID > 255 
GROUP BY 
    t.Name, s.Name, p.Rows
ORDER BY 
    TotalSpaceMB DESC

  • Standard Database reports
    • If you are using SQL Server Management Studio (SSMS), instead of running a query you can run a standard report
      1. Right click on the databass
      2. Navigate to Reports > Standard Reports > Disk Usage By Top Tables

Thursday, February 2, 2017

Advance Display method

InventOnHandItem form always a trickier one to customize. A requirement was put by customer to add bar-code number for an item in grid of InventOnHandItem form. Since in AX bar-code on items are assigned on combination of ItemId and InventDim, the trick here is that the InventSum is grouped by InventDim fields. So, your display method will not get an inventdim or inventsum record per se, but a grouped version of those, based on the display settings (the button Dimensions Display which you can find on a lot of forms in AX under the inventory buttons).

So first, since this is to be added as a form datasource display method, and used on a grid, we need the InventSum record passed in as a parameter to the display method. Next, we need to get the dimension field values from the inventdim record to be used in a new join. Since this display method is on the InventSum, we need to get the joined inventDim record, which we can get by calling "joinChild" on the inventSum buffer.

display ItemBarcode getItemBarcode(InventSum _inventSum)
{
    InventItemBarcode       itemBarcode;

    InventDim               inventDimLocal, inventDimJoin;

    // Important part
    inventDimJoin.data(_inventSum.joinChild());
    inventDimLocal.initFromInventDim(inventDimJoin);

    select firstOnly itemBarcode
        where itemBarcode.itemId == _inventSum.ItemId
    join RecId from inventDimLocal
        where itemBarcode.inventDimId == inventDimLocal.inventDimId
           && inventDimLocal.InventSizeId == inventDimLocal.InventSizeId
           && inventDimLocal.InventColorId == inventDimLocal.InventColorId;

    return itemBarcode.ItemBarcode;

 }

Output