Microsoft Dynamics AX Implementation Guide

My long time friends Yogesh Kasat of Real Dynamics and Jilajeet Yadav of Ignify have come out with an excellent book on handling Microsoft Dynamics AX Implementation Projects with ease and higher success rate.

The book describes about the common errors, issues and some real life experiences about AX implementation projects. This book caters to wide range of audience and is an all-in-one guide for DAX implementations.

You can read the article on this book here on Posts By Yogesh Kasat on LinkedIn or Dynamics World.

The book is available to be bought on Amazon, Packt Publishing, and other major places, both as an e-book or a hard copy.

Do get a copy for yourself. I have got mine🙂

Why should SAP and Oracle consultants consider a career move into Dynamics AX

Friends,

Here is a good article by Cognitive Group on reasons as to why other ERP consultants should rush to try their expertise in Dynamics AX. It’s a good read.

#DynamicsAX, #AXJobs

http://www.cognitive-group.com/blog/job-advice/why-should-sap-and-oracle-consultants-consider-a-career-move-into-dynamics-ax

2012 in review

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

19,000 people fit into the new Barclays Center to see Jay-Z perform. This blog was viewed about 61,000 times in 2012. If it were a concert at the Barclays Center, it would take about 3 sold-out performances for that many people to see it.

Click here to see the complete report.

Replace a Financial Dimension in Default Dimensions–Condensed [AX 2012]

In my previous post on Replacing default dimensions, I had provided a job to replace one financial dimension within a default dimension. The job was pretty big and I always thought that Microsoft should have provided some way to do these operations easily. Luckily I found a class that has helped me to condense that job and make it pretty small. I am sharing that job here:

The dimensions for Customer record looks like this before running the job:

image

Here is the job to change the values. We will change the values for Business Unit, Department and Worker all with this simple job:

static void replaceDefaultDimensionsCondense(Args _args)

{

    /*

     * In this job, we will replace the Business Unit Value from BU-001 to BU-002

     * and fill in the values for Department as Dep-001 and Worker as 114

     */

    CustTable                       custTable = CustTable::find(‘CUS-00004’); //Customer Record containing Financial Dimension

    Struct                          struct = new Struct(); //Structure to hold the dimension values to replace

    container                       defDimensionCon; //Container to prepare the required values and dimension attribute combination

    DimensionDefault                dimensionDefault; //Get the replaced dimension recid

    DimensionAttributeSetItem       dimAttrSetItem; //Table to get active dimensions for the legal entity

    DimensionAttribute              dimAttribute; //Table to get the Financial dimensions

    int i; //For looping

 

    //Loop for required dimensions

    while select Name, BackingEntityType from dimAttribute

        where dimAttribute.BackingEntityType == tableNum(DimAttributeOMBusinessUnit) ||

              dimAttribute.BackingEntityType == tableNum(DimAttributeOMDepartment) ||

              dimAttribute.BackingEntityType == tableNum(DimAttributeHcmWorker) &&

              dimAttribute.Type              != DimensionAttributeType::DynamicAccount

              join dimAttrSetItem

                where dimAttrSetItem.DimensionAttribute == dimAttribute.RecId &&

                      dimAttrSetItem.DimensionAttributeSet == DimensionCache::getDimensionAttributeSetForLedger()

    {

        //Add the Dimension name and display value to struct

        if (dimAttribute.BackingEntityType == tableNum(DimAttributeOMBusinessUnit))

        {

            struct.add(dimAttribute.Name, ‘BU-002’);

        }

        else if (dimAttribute.BackingEntityType == tableNum(DimAttributeOMDepartment))

        {

            struct.add(dimAttribute.Name, ‘DEP-002’);

        }

        else if (dimAttribute.BackingEntityType == tableNum(DimAttributeHcmWorker))

        {

            struct.add(dimAttribute.Name, ‘114’);

        }

    }

 

    //Prepare the container

    defDimensionCon += struct.fields();

 

    for (i = 1; i <= struct.fields(); i++)

    {

        defDimensionCon += struct.fieldName(i);

        defDimensionCon += struct.valueIndex(i);

    }

 

    //if there are fields in struct

    if (struct.fields())

    {

        //Get the DimensionAttributeValueSet table’s Record ID

        dimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(defDimensionCon);

       

        //Update to Customer

        ttsBegin;

        custTable.selectForUpdate(true);

        if (custTable.DefaultDimension)

        {

            custTable.DefaultDimension = DimensionDefaultingService::serviceMergeDefaultDimensions(dimensionDefault, custTable.DefaultDimension);

        }

        else

        {

            custTable.DefaultDimension = dimensionDefault;

        }

        custTable.doUpdate();

        ttsCommit;

    }

}

 

Dimensions after running the job:

image

Pretty Neat!

The class AxdDimensionUtil is pretty handy to do all these stuff.

Reports and Data Methods

In this post, I will explain how to use data methods in Reports. We will use the same Report model and report that we created in Building a Simple Report–Precision Design.

In AX 2009, AX SSRS had good use of these data methods. But with much better integration, and Reporting framework in AX improving, Data Methods in AX SSRS are reduced to minimal use.

Also the reason is that MS is soon going to do away with .Net Business Connector from next version hence the usage of data methods for many things will be redundant. What I have also noticed is the data methods have return type only as System.String and you will not be able to change this return type. This means, data methods can only return strings.

What I will try and demonstrate here is how to add links in AX reports (to open the corresponding forms).

To achieve this first we will add the reference to SRSDrillThroughCommon project. Do the following:

  • Open the SKL_SampleReportProject (refer to link above)
  • In Application Explorer, right-click Visual Studio Projects > C Sharp Projects > SRSDrillThroughCommon and then click Edit. This adds the SRSDrillThroughCommon project to our current solution

image

  • Open the report SKL_SampleReportPrecision project
  • Right click on the Data Methods node and create a new DataMethod. Name it CustDrillDown
  • You will also notice that a Business Logic Project is automatically added

image

  • In Solution Explorer, right-click the business logic project and then click Add Reference

image

  • Go to “Projects” tab and select “SRSDrillThroughCommon” and click Ok

image

  • Double click the data method this opens the Code editor
  • Add this line of code the declaration

using Microsoft.Dynamics.AX.Application.Reports;

 

  • Your code editor should be like this

using System;

using System.Collections.Generic;

using System.Security.Permissions;

using System.Data;

using Microsoft.Dynamics.Framework.Reports;

using Microsoft.Dynamics.AX.Application.Reports;

 

public partial class SKL_SampleReportPrecision

{

    [DataMethod(), PermissionSet(SecurityAction.Assert, Name = “FullTrust”)]

    public static string CustDrillDown(string reportContext, string custAccount)

    {

        return DrillThroughCommonHelper.ToCustomerForm(reportContext, custAccount);

    }

}

  • Right click on Precision Design and open the designer
  • Select the AccountNum text box, underline the text and set font color to Blue

image

  • Now right click on this text box and select “Text Box Properties…”, Switch to Tab “Action”
  • Select option “Go to URL” and click button “fx

image

  • Set Expression “=CustDrillDown(Parameters!AX_ReportContext.Value, Fields!AccountNum.Value)”
  • Click Ok
  • Save report, go to AX, deploy the report and run it. You should see following

image

  • Click on the link and the customer form opens up

image

Building a Simple Report–Precision Design

In this post, we will see how we can build a report using precision design. A precision design is like a pre-printed format where the placing of report controls, the design and the spacing matters a lot.

A precision design is the standard SSRS report designer following the same principles, rules and requirements as are found in a SQL Server Business Intelligence Studio SSRS designer.

We will again use the same example of printing Customer Id, Customer name and Balance but this time instead of creating an Auto Design we will use Precision Design.

I will also show how we can use some inbuilt parameters to display some generic information like page number, execution date and time etc.

Here we will use the same AOT query created in previous example Build and Deploy Simple Report–Queries: SKL_SampleCustomer

Create the Required Dataset

  • Open the previously created Report Model

image_thumb26

  • Right click on report model, select Add –> Report. Name the report SKL_SampleReportPrecision
  • Set the report title to “Customer balance”

image

  • Now in the report, go to the Datasets section and create new Dataset using the name Customer
  • In the query property, click the button image_thumb6
  • This opens up the query selection box to select a Microsoft Dynamics AX Query
  • From the list select “SKL_SampleCustomer” and click Next
  • image_thumb20

  • Here you can select required fields. Either you can select all fields or a subset
  • Expand All Fields nodes under the CustTable node to select “AccountNum”
  • Expand Node “All Display Methods” and select “name” and “openBalanceMST”
  • Click “Ok”
  • Now Right click on the designs node, select Add and then “Precision Design”. This creates a new Precision Design and name it as PrecisionReport

image

  • Now right click on new Design and select “Edit Using Designer”

image

  • This opens up the SSRS Designer (same as standard SSRS)
  • You can see the standard Report Item tool bar from where you can drag and drop the controls onto the designer surface

image

  • Now from the controls tool bar, drag and drop the Table control onto the Report Designer
  • Select the Tablix and then set the DataSetName property = “Customer”

image

  • Now let us specify headers, Select one text box in the header section and right click, then select “Expression…”

image

  • In the expression editor, you can see lot of sections for Variables, Parameters, Fields, Datasets etc.
  • Here write the following in the space “Set expression for: Value” –  =Labels!@SYS316441
  • This displays the header text using the labels in AX. This label is “Customer”

image

  • Now again specify the values in Second and third text boxes in header row
  • 2nd Column Header(Name) : =Labels!@SYS117778
  • 3rd Column Header (Amount): =Labels!@SYS62867

Specifying the data for the table

  • Now in the data row, move the mouse to first text box and you should see a button on the right side that looks as shown below

image

  • Click the button and it displays the list of fields from the dataset, select required fields

image

  • Alternatively, you can right and use “Expression…” box to specify the data fields. The expression box looks as shown below:

image

Now that the data is ready, we will go ahead and change the look and feel of the report

Formatting the table

You can specify the lots of formats using the properties windows like Background color, Font type color etc. You can also use the formatting tool bar above to format the data

image

Go ahead and specify the borders for the table for each row. Then change the background of the Header row. Make the text in the header row as center aligned and make the font as bold

Select the table rows one by one and change the font to “Segoe UI” and Font Size to “8pt”. Now your table looks as shown below:

image

Now we will go ahead and a Page Header and Page Footer. In Page Header, we will add Report name, Report Title and Execution Date and Time. In the Page Footer, we will add the Page Numbers in the format (Page of Total Pages)

To enable Page Header and Footer, in the Report menu select “Add Page Header” and “Add Page Footer” options

image

image

Now drag three text boxes from tool box and drop onto the Page Header area. Place two text boxes on the left hand corner and one on the right hand corner as shown below. Drag and drop one text box in the center of the Page footer as shown below.

image

Select the first text box, Open the expression box and in the Category section, select “Built-in Fields. Now double click on “ReportName” field and it should add the report name to value section

image

In the same way select “ExecutionTime” in third text box. For report title, Type in “Customer balances” in the second text box

In the footer section, select the 4th text box and type the expression ‘=Globals!PageNumber & ” of ” & Globals!TotalPages’

Apply formatting as required. Now you should see the design as follows

image

Now close the designer, add the report back to AOT (along with the model) and deploy the report from within AOT.

Create a new menu item

Go to AOT –> Menu Items –> Output, Right click and select “New Menu Item”. Set following properties

image

Now run the report and the report will be seen as shown below:

image