≡ Menu

For Future reference, I used following Queries to check the General Ledger Entry in Dynamics ax 2012. Small tip,

You can used them to delete posted ledger entry


select * from LEDGERJOURNALTABLE where JOURNALNUM =’XYZ-015528′


select * from LEDGERJOURNALTRANS where JOURNALNUM =’XyZ-015528′


select * from LedgerEntryJournal   where JOURNALNUMBER =’XyZ-015528′

select recid,* from GeneralJournalEntry where  LedgerEntryJournal= LedgerEntryJournal.RecID


select * from GeneralJournalAccountEntry where GeneralJournalEntry = GeneralJournalEntry.RecID




This post is series. In Last post we create some custom tables for  in Dynamics Ax.

Customization in New Dynamics AX (AK 7) Part 4- Custom Tables

In basic level we create two tables EarningCodeGroup and Earning Code. In this post we build simplest and very basic level forms.


Open the project and add a new Item and select Form  from “Add New Item “ Dialog and set its Name “AlEarningCodeGroup”



New form will be created in solution explore. Double click on it and open it in design mode.




Now right click on right side and select form Pattern.

Apply Pattern

From pattern select Simple list pattern.

You can read more details about simple list in the following



Patterns are applied but it described the following controls are missing.

Missing Controll




Now again right click on designer on and add action pane, custom filter group and grid.

Add new control


In first step I add the Action tab, then Add Action tab Pane page and then Button group and then add three command button.



Now update the different properties of Action Pane, tab strip and command button.

Change default to strip

Strip stryle

Set Caption as Home

Now select first command button set its text as New and command button as New.

Command Button Properties

Similarly set other two command button as Edit, and delete.

Now again right click on design and also add  group and rename it to grpFilter

Also right click on custom filter group and apply pattern We will see this in next post.



Now add Grid so form pattern requirement will be complete. Rename It to grpEarningCodeGroup. After that form design look like

Validated FormPattern


Now we go back to add table as a data source. We created the AxEarningCodeGroup in previous post, we will use that table here.

Grid data source





Set Name it with your table name, select table and set insertIfEmpty property to no.


Now go back and expand action pane => Pane and then button group  and update datasouce property to table  property to  AlEarningCodeGroup

Button Group DataSource property




Now right click on grid and press F4 or open property window and set datasource to AxEarnigCodeGroup and datagroup to grid (I created the field group with Name “Grid” In previous post”.

Grid dDaou


If you see, you find two fields are added under grid node


Grid fields




Now go back to solution explorer and create a new menu Item of type display


Name It as “AlEarningCodeGroupMenu” . New menu Item will be added on solution explorer. Double click on it to open it in design mode and Set Object Type to form and Object to AlFormEarningCodeGroup. Also Update its label Property to “Earning code Group”.



Open the AlEarningCodeGroup table in designer window and set its form ref to AlFormEarningCodeGroupMenu This will help us to add earning code group in earning code entry form.

Table Propeperties



Now we add the menu Item in  Menu to run and display,  For this open the menu Item in designer mode and drag menu item created in above step. In this post I am using custom Menu, If you are working with out of box menu then you must create menu extension then drag the menu Item in it.

Menu Display


Now run the application with Ctrl F5, I found the earning Code group in menu.

Live menu


By Clicking on link, forms open and I did following entries.


Data Entry







Suppose we are writing a custom module for Payroll. According to requirement, we have to create a custom table for Earning code. As well as Earning group.


At minimum we required following fields

Earn  Code Group Table

Earning Group of length 20.

Earning Group description length 60


Earning Code Table

Earning Code possible length 20.

Earning Code Description length 60.

Variable of fixed, If Variable the base value will be used as base percentage of Basic Salary, If fixed then base value will used as fixed amount.

Amount, The base value described as previous step.

And reference of Earning Code Group.


Lest explore some Extended data Type and enum and we create them with.


Extended Data Type:

For Extended Data Type is some kind of reusable data type based in primitive data type with some extra properties.

For example In Dynamics AX there is out of box extended Data type with “AmountCur”. It is Real based data Type. This extended Data Type usually used in amount related fields. So one of the many benefit of Extended data type is that we can change one place and it reflect where ever it used. For example, some organization want two decimal point while some required 4 decimal point. So if update decimal point at extended data type it update all fields where In our case we need to extended data Type, one for Earning code and one for Earning Group code,  For description fields we used the Out of the box field.

Now we have to create two extended data type .




Currently I am creating objects with AL extension. So I added a extended Data type of EDT String type and name it ALEarngingCode.  Clicking on Add. A new Extended will be added in Visual studio project. Double click on it and It will open in Designer window. Right click on it and open property window and set its size properties and 20.


Similarly, you can create ALEarningGroupCode







Similar there is enum is basically name of literal for example if we have Week days and enum then Sunday , Monday…. Saturday are literals.  In our current example we need Earning type as Fixed or Variable.


Double click on it and describe its detail on designer window


Add new Element


Double click and update Name and label.

Add name and label

Similarly add one more element




Now we have to add new tables.



Now we explore some important properties of Tables in

Table types.  We can define regular table in database or required temporary table. Temporary table stay in memory until its related object stay in memory. There are two type of Temporary tables.

In memory or Temp db, In memory are usually used in report. Temp db type are used when larger data and larger processes are instantiated.

In current example we use the regular tables.








Now add new tables First we create ALEarningGroup and then AlEarningCodes.

Add new item in visual studio and select table from add new Item dialog.

New Table


Set table name as as AlEarningCodeGroup, right click on table object in designer window solution explorer and open set table type as regular.






Now add two fields  with EarningCode and Description of string type
















Now expand field group and add new group Named to Grid and drag both fields into it








Similarly create another table for EarningCode


Add two fields AlEarningCode and fields EarningCode and description.


Now add one more field with type Enum


Set its name EarningcodeType  and set its enum Type to AlEarningCodetype, We created this enum type in previous steps.




Now add one more field with real type and set its







similarly create a Field group name Grid and drag all fields there.



Add one more string type for EarningCodeGroup we will map this field with Earning Code table for primary and foreign key relationship.


Indexes – are a way to speed up retrieval of data from a table


There are three types of Index in New Dynamics Ax.

A primary Index. This will provide the unique key to each record.  And field used in primary index used as primary or alternative key for table.

Second one is Clustered and not Clustered which are not scope of this post, we will discuss them in later post.

A clustered index organizes the data in the table in the order of the index.

Non-Clustered index is some kind of reference stored somewhere else to pointed to data. Example of the book index, placed at the end of book, reference of sorted title with page number.

Now we create Index in AlEarningCodeGroup table and then AlEarningCode


Update the following properties to    Alternate Key Yes, Allow Duplicates to now and set its name as idxEarnGode p



Now drag EarningCodeGroup Under index.



Now open table properties and add following  update Primary Index  to IdxEarningGrpCode and also select


Similar create index in ALEarningCodes




Table Relationship

There are two types of relationship in new Dynamics ax.

The first relationship type is called a normal relationship.  A normal relation is used to specify a relation without any conditions.

Another type of relation is called a foreign key relation.  This is used to specify a correspondence between a foreign key field in the present table to the primary key field in another parent table.  Foreign key relations are usually set on a child table.

In our current Scenario, we want to we want EarningGroup code as reference in EarningCode table. For this we expand relationship node of AlEarningCode and add new Relation based on Primary key relation


Updates relation Name and also select related table



Save it again right click and Select Normal relation




Click on Related Field fixed.


Now from selected screen select both related fields.

Save It compile, so Tables will be synchronizing to database.


In next post we will build simple data entry forms on these two tables.




I used following code snippet to get financial dimension attached with hcmposition


static void GetFinancialDimensionValue1(Args _args)


HcmPosition  position;

HcmPositionDefaultDimension  positionDefaultDimention;

DimensionAttributeValueSetStorage dimStorage;

Counter i;

select * from position

join * from positionDefaultDimention


where position.PositionId=="000001"

&& position.RecId == positionDefaultDimention.Position;




dimStorage = DimensionAttributeValueSetStorage::find(positionDefaultDimention.DefaultDimension);


for (i=1 ; i<= dimStorage.elements() ; i++)



info(strFmt("%1 = %2", DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name,







Reference:  https://jkmsdax2012.wordpress.com/2015/11/16/how-to-get-financial-dimensions-for-a-particular-customer-using-x-code-in-ax-2012/


today I got this error while running a custom report.

Cannot edit a record in  Table

An update conflict occurred due to another user process deleting the record or changing one or more fields in the record.



I found that this error occurs due to concurrent access to table is allowed. And we did not need concurrent access.

I change the ccEnabled to no




If this error occur on table that can be used on concurrent mode, then write tableBuffer.reread() before adding or modify data.



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


Hi, all very small tip today, Recently I have to add water mark in one of custom report.

In SSRS for Dynamics Ax 2012, we can achieve water mark by adding background image in report body.

Water mark image should be small in size and used as background Image. If you use high in size image, Report will threw errors on deployed at server.

This water mark can hide and show with ssrs expression.

So complete real word requirement will be Print report with water mark if certain criteria meets, other wise print report normal report.


At SSRS side right right  click on report Body and click on Body Properties.


From property window, select fill, select file the image source “embedded” and import file.


After import file will be shown as report explorer



Now add following expression  to show report display water mark or not.


=IIf(Fields! DuplicateCopy.Value=1,”Duplicate3″,””)




In new Dynamics Ax, the extensions are created for extension. Previously we use overlay or overwrite change in Out of the box Dynamics Ax object. For example, if we have to add some fields or modification we are overlay or adding changes in original Object. Object is overwrite in configured layer. But in new Dynamics Ax we create extensions. And we added changes in extension. And run time all these extension run as single object.


This is post is third in series, you can also view previous two posts as follow.

Customization In New Dynamics Ax (AX 7) Part 1 – Creating New Model

Customization in New Dynamics Ax (Aka 7)- Create New Module




Consider the scenario, that we writing our custom payroll and here is customer wants direct two 3 fields in Worker details.

  • National Identification Number.
  • Passport Number.
  • Passport Expire date.


For this we create extensions and add required fields in table. So expand Tables in Application explorer.     Right click on WorkerPersonalDetail table and click on extension.

Table extension2







New extension is created and double click on it a



Before that Right click on Project and set Data Base Synchronize properties true.

Visual Studio Properties


New added two string of length 20 character and added expire date and set extended data type of FromDate.


Add new group




Set properties


Drag new fields in it.


Now build project to synchronized to data base.


Now expand Forms and HcmWorker and creates it extension.



Double click on form extension and open it in designer





Expand he deign portion until you reach the control, where you want to add required field. for example I want to add New fields in PersonDetail section.



Expand profile Tab page and add new group as NIC and Passport.


Set its data source and data group as follow

New Fields

Save and Run Project by Ctrl+ F5.

Detail Page


On click and edit mode




Now we add values and save them

Values Save


This post is continuity of

Customization In New Dynamics Ax (AX 7) Part 1 – Creating New Model

In Dynamics New module is a Menu,


In this post we are Creating A new module In Dynamics where we add complete implementation.


So first step to create a menu Item


Double click on menu and open it in design area,







and then right click on it and update its name and label as follow


Now add new Menu item,



and Set its form properties to HCMWorker.






Now drag open again menu in Design screen and drag display menu from solution explore and save it.



Now expand the Main menu in AOT and right click on it and click on generate Extension in current project



You can see new extension in with MainMenu.Extension in solution explorer.

New Extension In Solution Explorer



Double click on It and open it in designer and then right click on it to create a new menu reference









Rename reference menu and set its menu properties to Menu which we create in previous step.




Because we are doing this is post is as introduction, so we set display menu target to HCMWork set it as starting object in Visual studio project.



Now compile, and Run Project With Ctrl+F5.

You can find our custom menu is appeared in Main menu.











Currently I am explore my Dynamics Development Skills in new Dynamics AX (Aka AX 7). So I decide to write series of post.

So first post is about creating Model and visual studio project.

Open Visual studio but did not create project, first step is Create new model. For this click on Dynamics AX menu and click on Create Model.




Suppose we write our custom payroll so I wrote Model name with payroll.


Write some something in Model Description.


In next step select Application suit.

Application Setup

Select and click on next.


Let this step to complete it, it will ask you to create a new Visual studio Project Select that option to create a new project, set its name Custom Payroll.

Dynamics Ax solution




Interesting, I was modifying some RDP based report, I found that parameter was passed to report through custom table, As report will run form button, and based on current selected record. So former developer did that on pressing button, selected value inserted some custom table. When report run, query on table and fetch required value form custom table and whole report logic run on that value. That approach works fine, single user environment. Problem I found to send parameter to report through x++ code. I found SrsReportRunController works wonder here.

Suppose we are running some report for customer, And Report Name is customer Report and we have to pass current customer account on form as parameter. If you report is based on Report data provider than following code snippet works for you.




SrsReportRunController          controller = new SrsReportRunController();

CustomerReprtDC  rdpContract = new CustomerReprtDC  ();

SRSPrintDestinationSettings     settings;