≡ 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

 

{ 0 comments }

 

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”

2016-09-13_22-36-57

 

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

FormDesign

 

 

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

https://ax.help.dynamics.com/en/wiki/simple-list-form-pattern/

 

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.

ActionTab

 

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.

ButtonFitler

 

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.

DataSourceProperty

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

DisplayMenu

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”.

DisplayMenuProperty

 

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

 

 

 

 

 

{ 0 comments }

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 .

2016-08-22_21-09-01

 

 

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.

Size

Similarly, you can create ALEarningGroupCode

 

extendedDataType

 

 

 

Enum:

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.

AddNewEnumBase

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

newElements

 

Tables.

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.

TypeGroup

 

 

 

 

Now add two fields  with EarningCode and Description of string type

 

Fields

 

 

 

 

EarninCodeGroup

 

DescriptionProperties

 

 

 

 

 

 

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

EarnCodingDetailss

 

 

 

 

 

 

Similarly create another table for EarningCode

 

Add two fields AlEarningCode and fields EarningCode and description.

earningCodeTable

Now add one more field with type Enum

EnumField

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

EnumSelection

 

 

Now add one more field with real type and set its

 

 

EarnCodeAmountCur

 

 

 

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

EarnCodeTableee

 

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

WithEarningCodeGroup

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

EarningCodeGroup

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

 

Index

Now drag EarningCodeGroup Under index.

 

IndexGroup

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

IndxGroupProperties

Similar create index in ALEarningCodes

EarningCodeTableIndex

 

 

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

PrimaryRelation

Updates relation Name and also select related table

RelationProperties

 

Save it again right click and Select Normal relation

 

PrimaryKeyRelationDetails

 

Click on Related Field fixed.

FieldSelectionInRelation

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.

 

{ 0 comments }

 

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,

dimStorage.getDisplayValueByIndex(i)));

 

}

}

2016-08-15_23-14-22

 

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

{ 0 comments }

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

Concurrent

 

 

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

{ 0 comments }

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.

2016-08-04_11-38-16

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

Import

After import file will be shown as report explorer

 

Duplicate

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

 

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

{ 0 comments }

 

 

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
ExtensionDetails

 

 

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.

GroupDetails

Add new group

NewGroup

 

 

Set properties

PasportGroup

Drag new fields in it.

GroupDetails

Now build project to synchronized to data base.

 

Now expand Forms and HcmWorker and creates it extension.

FormExtension

 

Double click on form extension and open it in designer

 

Expand

 

 

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.

ExpandDesigner

 

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

FormNewGroup

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

 

Edit

 

Now we add values and save them

Values Save

{ 0 comments }

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

CustomMenu

Double click on menu and open it in design area,

 

 

 

 

Designer

 

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

MyCustomPayrollProperties

Now add new Menu item,

menuDisplay

 

and Set its form properties to HCMWorker.

 

MenuDisplayProperties

 

 

 

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

Drag

 

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

Extension

 

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

 

NewReference

 

 

ReferenceMenuName

 

 

 

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

 

ReferenceProperties

 

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.

 

VisualStudioProject

Now compile, and Run Project With Ctrl+F5.

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

MainMenu

 

 

 

 

 

 

 

 

{ 0 comments }

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.

2016-07-25_1-24-11

 

 

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

 

Write some something in Model Description.

2016-07-25_1-35-16

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

 

 

{ 0 comments }

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;

super();

controller.parmReportName(ssrsReportStr(CustomerReport,CustomerCopy));

 

 

controller.parmShowDialog(false);

rdpContract.parmCustAccount(CustTable.AccountNum);

controller.parmReportContract().parmRdpContract(rdpContract);

controller.startOperation();

{ 0 comments }