• Skip to main content
  • Skip to primary sidebar
  • Home
  • About
  • Recommended Readings
    • 2022 Book Reading
    • 2023 Recommended Readings
    • Book Reading 2024
    • Book Reading 2025
    • Book Reading 2026
  • Supply Chain Management Guide
  • PKM
  • Microsoft Excel
  • Microsoft Copilot in Office 365
  • Public Wiki Page

Ali Raza Zaidi

A practitioner’s musings on Dynamics 365 Finance and Operations

Dynamics Ax 2012

Dimension did not save as Personalization Dynamics Ax 2012 R2, R3

August 21, 2015 by alirazazaidi

Today I got strange query from client that we are adding dimensions like Style in “All production Order” list page using Personalization option. Field added into grid but when we close and reopen the form, it disappear from grid. So there is possible issue with dynamics Ax installation.

ProductionOrder

When I started to investigate, it was only issue with dimension fields ,  if you save any field from Production order it will save, for example If I want to save “BomId”, It is properly save with respect to user and display on grid.


sss

For Dimensions, Please go to View tab and click on Dimension and add Dimension, it will save and will available for all

ddd22

 

 

sss222

Hopes this will helps

MS Dynamics Ax 2012 Infrastructure ppt

August 16, 2015 by alirazazaidi

Today I was searching information about MS Dynamics Ax 2012 infrastructure, I found old but excellent power point presentation slide for Dynamics Ax 2012 on slide-share by Davy Vliegen
[slideshare id=10382116&doc=infra-111129063457-phpapp02]

Field Mismatch in Union Query in Dynamics Ax 2012 R3

August 5, 2015 by alirazazaidi

Yesterday, after code merger or migrate from Dynamics Ax 2012 R2 to R3, I got very strange errors in AOT Query or static Query. Error was already reported and solved by different MVPs like Martin Darb and Tommy Skaue.
“Field Mismatch in Union Query”.

UninonError

 

In code migration, they increased the field length of EDT. For example for Unknown reason In one of customs code, they increase the “Name” EDT from 60 to 120 character. And this result into creating problems in Union Based Queries.

I solved it following way.

  • Expand the Union Query.
  • Select all views one by one. And check that field on which exception through.
  • Expand the query on which view,
  • Locate the table, and from field I get the EDT name
  • Change the length of EDT and let it synchronize.
  • Expand the table and check the field Length.
  • Expand the View it shows the old length.
  • Expand the query, Right click on it and restored. If length did not reflect change and no customization in View.
  • Right click and delete it. View will delete and restored again from Sys layer. New view will shows the update length.
  • Compile the query.

Reference : https://community.dynamics.com/ax/f/33/t/103490
http://axvuongbao.blogspot.com/2013/12/fix-parameter-could-not-be-serialized.html
http://dynamicsuser.net/forums/p/74382/400861.aspx

Relation between VendPackingSlipTrans and VendInoiceTRans Dynamics Ax 2012

July 31, 2015 by alirazazaidi

Today I got chance to find a relationship between vendor packing list and vendor Invoice.  I was expecting that it there was direct relationship between VendPackingtrans and VendInvocietrans. If you expand VendInvoceTrans, there will be a relation but that relation will never use in Dynamics ax 2012. After searching I found VendPackingSlipQuantityMatch table which has relation between VendPackingTrans and VendInvoiceTrans.

VendPackingSlipTrans _PackingTrans;

VendPackingSlipQuantityMatch _ VendPackingSlipQuantityMatch;

vendInvoicetrans _ vendInvoicetrans;

I got the VendInvoiceTrans and VendPackingTrans as follow.

select firstOnly * from _PackingTrans

join _VendPackingSlipQuantityMatch

where _VendPackingSlipQuantityMatch.InvoiceSourceDocumentLIne ==vendInvoiceTrans.SourceDocumentLine

&& _PackingTrans.SourceDocumentLine == _VendPackingSlipQuantityMatch.PackingSlipSourceDocumentLine;

Custom AIF Service in Dynamics Ax 2012 R3 from Scratch.

July 29, 2015 by alirazazaidi

Today I decide to experiment with custom service. So I decided to create custom table with Name MyColorTable.

 

This table contains only one field Name. and made it unique with no allow duplicate on Index.

MyColorTable

 

If we consider custom service in Dynamics Ax 2012, it contains following objects

 

  • X++ Data contract class
  • X++ Service contract class
  • Service Node
  • Service Group node.

 

Data Contract class

So first we create Data contract class

Suppose Our data contract class name is  ColorDc

 

 

[DataContractAttribute]

class ColorDC

{

Name ColorName;

}

Now add a new method with Name ParmColorName and set its as

 

 

[ DataMemberAttribute('ColorName')]

public Name parmColorName(Name _ColorName=ColorName)

{

ColorName=_ColorName;

return ColorName;

}

 

 

Service contract class:

Now we write a Service class which contains Three method Purpose of these method to explore the require attribute for getting parameter in service method and return list from service method.

InsertColor. (This method contains single color)

InsertColorList (This method take list of colorDC as parameter).

GetColorList ( This method return list of colorDC).

 

[SysEntryPointAttribute(true),

AifCollectionTypeAttribute('Colorobj', Types::Class)]

public void InsertColor(ColorDC Colorobj)

{

MyColorTable _Color;

Name _Name;

 

_Name = Colorobj.parmColorName();

 

select * from _Color where _Color.Name== _Name;

 

if (_Color==null)

{

try

{

ttsBegin;

_Color.Name = _Name;

_Color.insert();

 

ttsCommit;

}

catch

{

ttsAbort;

}

 

}

}

In above method we add some attribute which allow this method to act as web method and attribute help us define the expected parameter for this method call.

 

Now we call create another method, here attributes also described method as webmethod and also method expect what type of parameter.

[DataMemberAttribute("InsertColorList"),

AifCollectionTypeAttribute("ColorList",Types::Class, classStr(ColorDC))

]

public Void InsertColorList(List ColorList )

{

ListIterator  iterator;

ListEnumerator  enumerator;

ListIterator   literator;

ColorDC       _color;

 

 

enumerator = ColorList.getEnumerator();

 

while(enumerator.moveNext())

{

_color= enumerator.current();

if (_color !=null)

{

this.InsertColor(_color);

}

}

 

}

 

 

Now get method which return all color in Ax.

[SysEntryPointAttribute(true),

AifCollectionTypeAttribute('return', Types::Class, classStr(ColorDC))]

public list GetColorList()

{

ColorDC Colorobj;

List _ColorList = new List(Types::Class);

MyColorTable  Colorbuf;

while select * from Colorbuf

{

 

Colorobj = new ColorDC();

Colorobj.parmColorName(Colorbuf.Name);

_ColorList.addEnd(Colorobj);

}

return _ColorList;

}

Now compile it now

Service Object:

create a service object and set Service contract class there

New Service

Expand ColorService object and Right click on Operations and click on add method, this way we can restrict which method need to expose in service or which method need not.

AddOperation

2015-07-28_6-40-49

Click on all check boxes and enabled them

Service Group:

Create a new service group and drag and drop service object under it.

2015-07-28_6-41-15

 

 

 

Right click on ColorServiceGroup and deploy the service

Deploy

 

Wait and let It deploy Info box shows the message that service is deployed successfully

2015-07-28_12-38-21

 

 

No service is successfully deployed, Now open Ax client , from Administration section. Setup=> AIF => Inbond port.

AIF

Copy WSDL URI.

 

Open Visual studio and create a new Console application for testing the code.

Right click on references and ad service reference

ssss

 

2015-07-28_13-01-06

 

 

 

 

First we call insert the records in service.

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace ConsoleApplication2

{

class Program

{

static void Main(string[] args)

{

ColorServiceGroup.ColorDC cd1 = new ColorServiceGroup.ColorDC();

cd1.ColorName = "Red";

ColorServiceGroup.ColorDC cd2 = new ColorServiceGroup.ColorDC();

cd2.ColorName = "Blue";

ColorServiceGroup.ColorDC cd3 = new ColorServiceGroup.ColorDC();

cd3.ColorName = "Yellow";

 

ColorServiceGroup.ColorDC[] DcList = new ColorServiceGroup.ColorDC[] { cd1, cd2, cd3 };

ColorServiceGroup.ColorServiceClient _Client = new ColorServiceGroup.ColorServiceClient();

 

ColorServiceGroup.CallContext _CallContext = new ColorServiceGroup.CallContext();

_CallContext.Company = "USMF";

_Client.InsertColorList(_CallContext, DcList);

 

 

 

 

 

}

}

}

When I run the above code in Visual studio  records are successfully inserted in original table.

TableBrowser

 

 

Now we call list of colors exist in Dynamics Ax 2012.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace ConsoleApplication2

{

class Program

{

static void Main(string[] args)

{

 

 

 

ColorServiceGroup.ColorServiceClient _Client = new ColorServiceGroup.ColorServiceClient();

 

ColorServiceGroup.CallContext _CallContext = new ColorServiceGroup.CallContext();

_CallContext.Company = "USMF";

ColorServiceGroup.ColorDC[] _DcList=   _Client.GetColorList(_CallContext);

//    ColorServiceGroup.ColorDC _Dc ;

foreach (ColorServiceGroup.ColorDC _Dc in _DcList)

{

Console.WriteLine(_Dc.ColorName);

 

}

 

Console.ReadKey();

 

 

 

}

}

}

When I run the above code, all records exists in Ax display on c# console

2015-07-29_15-49-25

 

Dynamics AX 2012 R3 CU9 Update : Step-By-Step

July 12, 2015 by alirazazaidi

Download from partner source or customer source.

  • AXUpdateInstaller
  • DynamicsAX2012R3-KB3063879-SlipStreamOnly

Extract AXUpdateInstaller.

image001

Now also extract the silpstream  in same folder where AX 2012 AxUpdateInstaller extracted.

Extractioned folder

 

If you did not download slipstream, then during setup it will ask and download it at run time.

Now before running setup perform following steps to

Environment preparation:

  1. Backup business and model store databases. Backup the database that is being updated.
  2. Make sure that you are an Admin on local computer and System Administrator in Dynamics AX.
  3. Make sure that you are a member of “SecurityAdmin” server role on the SQL Server instance.
  4. Make sure that you are a “db_owner” role in model database.
  5. Make sure the system runs in single-user mode while installing this update (or down-time).

 

 

From extracted folder Click on axupdate.exe with administrator rights.

2015-07-12_11-49-57

 

Click on next

Next

 

 

 

 

Click on Accept and continue.

2015-07-12_11-52-56

It is my testing own Virtual machine, So select Model store According to your environment.

 

Click on it and it will take time, not more then 5 to 10 minutes.

 

2015-07-12_12-03-39

Click on next button

 

2015-07-12_12-50-39

Select the component you want to update , for current article I select all.

 

Let it install it.

2015-07-12_12-56-37

After that following screen appears describe the successful update

Installation

2015-07-12_15-33-52

 

 

Post Installation:

sss

 

Perform initialization steps

ss

 

RDP or Business logic based SSRS Reports in Dynamics Ax 2012 R3.

July 8, 2015 by alirazazaidi

RDP or Business logic based SSRS Reports in Dynamics Ax 2012 R3.

 

Logic based report in MS Dynamics Ax 2012 can be develop in following steps

 

  1. Create a temporary table
  2. Define the report parameters
  3. Add business logic for the report
  4. Create a reporting project
  5. Bind a report to a report data provider class

 

In graphical shape RDP reports will be as

Code Based Report

Image Inspiration http://dynamics-ax.blogspot.com/2011/12/ax-2012-ax-ssrs-report-design-concepts.html

 

 

Now consider a scenario, where we have to display list of Item, quantity, Price and total amount sold to customers. It is relatively simple report but have to build this report based on RDP or Report Data Provider framework.

 

First step to open an Ax client. When Ax client open press Ctrl + shift +W keys to open Dev environment or AOT.

 

For all artifacts for report development will be a single place and we did not move to node to node in AOT we have to create a AX project.

 

You can find projects at View=>Projects => Public project.

Create a new project at and rename it with “CustomRDBReport”

ss

 

 

 

Step 1 create a temp table.

The major step in RDP report is decision the fields require in report, create a temp table and add these field in temp table. For current example what fields we required on report are as follow

 

  • CustomerAccount
  • CustomerName
  • ItemId
  • ItemName
  • SalesPrice
  • SalesQuantity
  • SalesAmount

 

If we see these fields exists in SalesLine Table. So we drag them into our temp table, and rename them accordingly

Right click on project and create at table with Name “CustomerSalesTemp”,

TableCreation

 

From property window rename the table as “CustomerSalesTemp” and set  TableType to   tempDb

TempDb

 

Now close all window, open AOT and opens salesLine table. From top menu click on windows => Tile and both tables comes in parallel to each other

Tiltle

and start drag and drop fields in temp table

Drag fields

Now save the table and rename the fields accordingly if required. Also add a new field with Name CustomerName with extended data Type with Name.

 

 

Right click compile and synchronize table.

 

 

 

 

Now create a AOT Query with Name QSalesLine. Add data source on SalesLine and Add following fields on Salesline table

QSalesLine

 

For Date Fileter, we will use ShippingDateConfirmed on Date.

Safe this query.

 

Step 2 define the report parameters

For current report we required three parameters, Customer, From date and To date.

In Report Data Provider framework which is based on WCF, we have to create a data contract class.

Create a new class in, rename it, CustomerSalesDataContract.

In its declaration section create three variables

 

[DataContractAttribute]

class CustomerSalesDataContract

{

CustAccount CustomerAccount;

TransDate FromDate;

TransDate ToDate;

}

 

 

 

Now Create three data method

[

DataMemberAttribute(identifierStr(CustAccount)),

SysOperationLabelAttribute (“Customer Account”),

SysOperationHelpTextAttribute(“Customer Account”),

SysOperationDisplayOrderAttribute(“1”)

]

public CustAccount  parmCustomerAccount(CustAccount  _CustomerAccount = CustomerAccount)

{

CustomerAccount = _CustomerAccount;

return CustomerAccount;

}

 

 

[

DataMemberAttribute(identifierStr(FromDate)),

SysOperationLabelAttribute (“From Date”),

SysOperationHelpTextAttribute(“FromDate”),

SysOperationDisplayOrderAttribute(“2”)

]

public TransDate  parmFromDate(TransDate  _FromDate = FromDate)

{

FromDate = _FromDate;

return FromDate;

}

 

 

[

DataMemberAttribute(identifierStr(ToDate)),

SysOperationLabelAttribute (“To Date”),

SysOperationHelpTextAttribute(“To Date”),

SysOperationDisplayOrderAttribute(“3”)

]

public TransDate  parmToDate(TransDate  _ToDate = ToDate)

{

ToDate = _ToDate;

return ToDate;

}

 

 

 

 

Step 3 Add business logic for the report.

In Report data provider framework we have to write Data provider classes, which contain business logic to populate temp table. For this we have to add create a new class “CustomerSalesDataProvider”

Extend this class SRSReportDataProviderBase

 

 

[

 

SRSReportParameterAttribute(classstr(CustomerSalesDataContract))

]

 

class CustomerSalesDataProvider extends  SRSReportDataProviderBase

{

CustomerSaleTemp _CustomerSaleTemp;

}

 

 

This Class two method, first is return the temp table, and second one is which contains the logic to populate  temp table.

 

[SRSReportDataSetAttribute(“CustomerSaleTemp”)]

public CustomerSaleTemp getCustomerSaleTemp()

{

select * from _CustomerSaleTemp;

return _CustomerSaleTemp;

}

 

 

 

public void processReport()

{

TransDate _FromDate;

TransDate _Todate;

AccountNum _CustAccount;

CustomerSalesDataContract dataContract;

 

Query query;

QueryRun queryRun;

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange queryBuildRange;

QueryBuildRange ShippingDateConfirmedFilter;

SalesLine querySalesLine;

 

 

query = new Query(queryStr(“QSaleLine”));

dataContract = this.parmDataContract();

_CustAccount = dataContract.parmCustomerAccount();

_FromDate = dataContract.parmFromDate();

_Todate= dataContract.parmToDate();

 

queryBuildDataSource = query.dataSourceTable(tablenum(SalesLine));

if (_CustAccount)

{

queryBuildRange = queryBuildDataSource.findRange(fieldnum(SalesLine, CustAccount));

if (!queryBuildRange)

{

queryBuildRange = queryBuildDataSource.addRange(fieldnum(SalesLine, CustAccount));

}

}

ShippingDateConfirmedFilter = SysQuery::findOrCreateRange(query.datasourceTable(tableNum(SalesLine)),fieldNum(SalesLine,ShippingDateConfirmed));

ShippingDateConfirmedFilter.value(SysQuery::range(_FromDate,_Todate));

 

queryRun = new QueryRun(query); ttsbegin;

while(queryRun.next())

{ _CustomerSaleTemp.clear();

querySalesLine = queryRun.get(tablenum(SalesLine));

_CustomerSaleTemp.SalesPrice =  querySalesLine.SalesPrice;

_CustomerSaleTemp.ItemId =  querySalesLine.ItemId;

_CustomerSaleTemp.ItemDescription =  querySalesLine.Name;

_CustomerSaleTemp.SalesQty =  querySalesLine.QtyOrdered;

_CustomerSaleTemp.CustAccount =  querySalesLine.CustAccount;

_CustomerSaleTemp.CustomerName = CustTable::find(querySalesLine.CustAccount).name();

_CustomerSaleTemp.insert();

 

 

 

 

}

ttscommit;

 

}

 

 

 

 

 

Now compile the class, generate Incremental CIL.

Step 4 create a reporting project

Now open Visual studio and create Model project say “CustomSalesLineReport”.

VisualStudio

From solution explorer, create a new report rename it RDPSalesLineReport

RDPSalesLineReport

 

 

Step 5 Bind a report to a report data provider class

 

Now double click on report and open it in

ExpandDataSet

 

 

Add new DataSet and rename it “DSSalesLine”. On right click and from property window set Data Source Type to “Report Data Provider”

 

RDPSettings

 

And click on Query and from browser window select The data provider class we created in previous step

CustomerSalesDataProvider

 

Click ok to create fields

FieldsDetails

 

Now drag and drop data set to Design node in report to create AutoDesign.  Rename it “RDPSalesLine”

 

Drag and drop

Expand “RDPSalesLine” design and drag and drop CustAccount field from Data Set to Group and sort nodes

SortAndGroup

 

Expand parameter of report and open the property of CustAccount parameter and set its allow blank to true and nullable to true, so if no customer is selected, report will run for all customer in legal entity

CustAccountSales

Save the report compile it, deploy it and add to AOT

 

Now switch back to AOT.  Create a new menu Item under Display node.

Mnu

 

And set menu item Name as “mnuRDPSaleLine” and set its properties as follow

MnuSettings

 

Save it and right click on menu item and open it

 

Report Dialog

 

Set values for From Date and To date and run the report, Report will work with business logic as follow

 

Sales

 

 

An item with the same key has already been added. SSRS Dynamics Ax 2012

July 4, 2015 by alirazazaidi

Today I got this strange error “An item with the same key has already been added “, Very interestingly I got no error during compilation or deployment of report

when I run the report I got this error

An item with the same key has already been added.

 

On investigate I found this error is due to meta data of report. Report is based on Query. On Exploring Query I found that I added the same field two times, At report run time I got error due to duplication of same field. If you see the below screen shoot you  will found that “CustGroup” appears two times in Query, I removed the Duplicate field. compile the Query, Refresh the report data source, compile, deploy and add to AOT. Report run successfully.

 

AllFields

Form Development from scratch Dynamics Ax 2012 R3 part 2

June 1, 2015 by alirazazaidi

Now we start development of form. First form we will build for Simple list form for Diagnostic table

For this open AOT and right click on Form Node and click on simple list form template

SimpleListSelection

 

Drag newly created form in Project and rename it “DiagonasisticTable”.

DiagonasisticTableForm

Expand DiagonsisticTable form and Right click on data source node to new Data source. Update name of name and Table name as DiagonsisticTable.

DiagnonsticDataSource

Now expand Designs=> Design Expand=> group Container and select grid

 

Grid

Right click on grid, click on properties window and set these properties

Data Source: DiagonasisticTable

DataGroup: overView

GridProperties

 

Save the form and right click on form open it. The form will look like similar

NewDiagonaistic Form

 

If you try to enter duplicate values in Diagnostic number field. Due to unique index on Diagnostic number it did not let you do it.

DiagonistiIndexWorking

 

 

 

 

New create a display menu with Name “MnuDiagonisticTable” and set it object Type to form and object Name as “DiagonisticTable”.  Save it.

diaganostic

 

Now expand Diagonaistictable right click on it and set its “FormRef” property with mnuDiagonisticsTable

DiaganosticViewMnu

This property provides us option of “View Details” on lookup field. We see its function in Master detail form.

 

Detail form:

 

Now we create a detail from for patient table. Create a new form and add data source and set its Name and DataSource value to Patienttable.

patientTableForm

Right click on PatientTable data source and set “InsertIfEmpty” to false

AdmissionSource

 

Now expand Designs and add new action tab, inside button group add three command buttons.

Rename them into “btnNew”, “btnEdit” and “btnDelete”. And from property window set their command to new, edit and delete.

NewButton

 

You can also select button Image by update following Properties

 

New Img property

Now expand Designs=>Design under ActionTab add a new Tab. Set Tab style property to fast tab.

Add new tab page in Tab and set is width and height value as follow

 

Tabs

 

 

Add new group control set its width and height like above one and column property to 2.

And set is data source to patientTable and Data group property to overview

PatientGroupProperties

Now form structure will look like

PatientDetailsStructure

Now open the form let’s see how it look like

PatientDetailsgroup

Test the form and click add remove entries

PatientFormWithData

 

Parent child form:

 

Now we expand patientTable form to Parent child form.

Now expand DataSource of node of PatientTable form and add a new data source. And set its table property to AdmissionTable, Name to AdmissionTable, and Set its JoinSource to PatientTable

 

AdmissionSource

 

 

PasteActionTabl

 

 

Now expand the form designer and add a new tab Page under patient tab and add new action pane There Set DataSource Property of ActionTab to AdmissionTable so all control inside this action tab works for AdmissionTable. In Button group add three command buttons and set their name “BtnNewAdmission”, “BtnEditAdmission” and “BtnDeleteAdmission”. After this set  there command property  to “New”,”Edit” and “Delete”.

AdmissionButton

Now add a grid in this tab and set its data Source to AdmissionTable.

AdmissionGrid

 

 

Drag and drop fields from AdmissionTable data Source to grid

AdmissionGridFields

 

Now open the form lets how it look like

Our parent Child from

You can see that here admission Date is greater than Discharge Date, for this we have to add some validation rules, which are not part of current post. We let it go.

AdmissionTableGridWorks

If you right click on diagnostic number field in grid, from pop up menu view detail option leads us Diagnostic table form.

ViewDetail link

 

This option comes due to we add menu Item in table properties in one of above step I am again adding its picture here

DiaganosticViewMnu

 

Now we create a new Display Menu Item “MenuPatientTable” and set its object property to

PatientMenu

 

Now we create a List page for Patient and attached Patient detail form with it.

 

For list page template we cannot attach table in data source for this we can create a Static Query Object. This Query Object will use as data Source in Form

 

First we have to create a Query. Re Name it to PatientQuery and form its DataSource add Patient table

PatientQuery

 

Expand PatientTable source in data table and right click on fields and set its field property to yes

QueryFieldDynamicsYes

 

After saving you will find all fields in Query

QueryFieldDetails

 

 

Now open AOT and right click on Form Node. From pop up menu select form template and then select list page.

ListPage

 

Now search form with similar CopyOfSysBPStyle_ListPage Name.  Drag it to your project and rename it to PatientListPage

PatientListPage

Now expand Patient List page and set data source and sets property to PatientQuery. This query we created in previous step

PatientListPageQueryDataSource

 

This will result in all tables in query in forms data source. By default these table have create and edit to no.

PatientListPageTablesList

Expand Designer  node of Form and select grid and set its dataSource property to Patient and drag and drop required fields from PatientTable_1 data Source to form.

 

Patient list Page grid

 

Now drag and drop required fields from data source to grid

PatientListPageGridFields

 

PatientListPageWorking

 

Now we are going to attached PatientDetail form with Patient

Now we add the Add, edit, delete and view functionality which leads the PatientDetail form

Expand the action tab in form and right click on menuItemButton  “newbutton”

PatientListPageAddNew

Set following properties

 

PatientAddNewButton

 

Expand next button group “MaintainedGroup” and and Open property window of EditButton

 

PatientlistPageEditButton

From Property window set following fields

DataSource = “PatientTable_1”

OpenMode =”Edit”

CopyCallerQuery=”Yes”

MenuItemName =”mnupatientTable”

PatientListPageEditButtonProperty

 

Now select mnuItemButton “ViewButton”

patientListPageViewButton

 

From Property window and set

DataSource = “PatientTable_1”

OpenMode =”View”

CopyCallerQuery=”Yes”

MenuItemName =”mnupatientTable”

 

PatientListPageViewButtonProperties

 

 

 

 

 

Now expand grid in form and set following property to MenuItemButton “ViewButton”, which we set in above step, so when we click on grid, detail form opens

patientListPageGridProperyToOpenListViewPage

 

 

Now run the form and lets try all functions.

 

Now create a new Display menu Item Say “MnuPatientListPage”. Set its form Property as follow

Menufor ListPage

 

Suppose That is hospital registration development is part of Accounts Payable module.

MnuList

Expand the menu Accounts Payable module expand common.

Add a new menu Item or drag drop existing menu item Common Set its following properties

Menufor ListPage

 

Now Open Ax client and open Account Payable area page

AccountsPayableAreaPage

 

PatientListPageINClient

 

Form Development from scratch Dynamics Ax 2012 R3 part 1

June 1, 2015 by alirazazaidi

Consider a scenario where we are going to build small Hospital Admission System in Dynamics Ax 2012.  This Add-on is based on small database design based on

 

http://dhdurso.org/articles/ms-access-database-ad.html

 

db

 

 

We divide this task into two posts

For this post, we are cover following points to develop this small add-on

  • Ax Project
  • Patient, Diagnostic and admission table.
  • Simple list page for diagnostic table.
  • Entry form for Patient table (Detail form).
  • Parent Master detail form based on Patient ,Diagnostic table and patient.
  • List page for Patient table.
  • Integrate Patient List page with Patient Detail form.

 

 

 

AX Project:

 

AX Project for collecting Ax artifacts in single location.

When we create any Ax object they have to create under certain node. For example tables, forms, Classes, menu all stored in their respected node.

In Dynamics Ax we can create a Project which is not more the logical grouping of all Ax artifacts.

In these project, we create object groups and then placed our required object either drag and drop from AOT or create them here.

Advantages of Projects are

  • Logical grouping, it’s easier to locate required artifacts one location.
  • When we export project as Xpo, All objects are exported as single XPO.
  • We can export whole project into model, all object in project moved from one model to other model in single steps.

 

 

Lets make a new project

 

From top menu Click on View=> tools=> Project

Ax Project

Following Screen will open

Shared and Private Project

Right click on Shared folder and create a Project and renamed it to HospitalManagementSystem.

 

Hospital Management System Menu

 

New Project Managment

 

Click on Project and open it. Right click on it new => Group to create new groups

 

Details

For example we create Form group and set it Name and Project Group type to forms

Project name

 

Now Project is look like

Project Details

 

Similarly create other groups.

menu

 

 

Table structure design.

 

 

db

So our table structure look like

Diagnostic table

Column Extended data Type Primitive Data Type
DiagNo DiagnosticNumber Str10
Desc Description
Cost AmountCur Real

 

 

Patient table

Column Extended Data Type
PatNo PatientNumber Str 20
Fname Name
LName Name
BirthDate BirthDate
Address T_Address Str 20
City T_City Str20
State T_State Str20
Zip T_Zip Str20
Gender T_Gender

 

 

AdmissionsTable

 

Column Extended Data Type Primitive Data Type Foreign Key
AdmitNo AdmissionNumber Str20
PatNO Patient Number Patient table
Diag_code Diagnosticnumber

 

Diagnostic table

 

Adminationdate FromDate date
DischargeDate ToDate date
CoPay Notes Notes

 

First we create a extended data type required in three tables.

First one is DiagonisticNumber extended Data Type

Extended Data Type

Rename it and set its name as “DiagnosticNumber” and its string set its size to 10

ExtendedDataTypeSize

Similarly create all extended data type

List of Extended Data Type

Rest of we use out of the box extended Data Type

When you save any Extended Data Type, Ax ask for Synchronize database cancel it when all extended data Types created let it complete

DataBase Schyrni

 

 

 

 

 

In current example only gender is enum type, we create new base enum T_Gender instead of using out of box Gender enum.

 

Base enum menu

Create a new Enum and name it “T_Gender” t stands for training.

 

Right click on it and create a new element

Base Enum new Element

 

 

Set its name and label

 

SubType

Base Create one more element and it will look like

Base enum look like

 

 

Now create a click on tables group and right click and create a new table

 

 

Rename it to “DiagnosticTable”.

TableProperties

 

Now create a new field with Name “DiagNo” of string type and set its extended data type to “DiagnosticNumber”

 

FieldName

eeee

 

Similarly create all other fields in table

Diagnonstic

 

Now expand field Groups node in Table and Create a new Field group with Name “OverView”.

Overview

Drag all fields in it.

DiagnonsticDetial

 

Now want to make the Diagonistic and unique and make it primary key. For this right click and create unique index on it

DiagnonsticIndex

Rename it to DiagNoIx and set its AllowDuplicate Property to No and Alternate key to Yes

IndexDetails

Now drag DiagNo from fields node to DiagosticIdx.

Diagonisticss

 

 

Now right click on DiagnosticTable and set following Properties with newly created Index

 

DiagnonsticProperties

 

Perform same steps to create PaitentTable, create Index on “PatNo” similar way.

PatientTab

 

Create a new field group with overview and arrange field in a way that you want to see them in form

FieldsDetails

 

Create unique index on PatientNumber

PatientDetails

Similarly create AdmissionTable,

AdmissionTable

 

 

Now right click on Relation node in AdmissionTable and create a new relation and rename it to “PatientRelation” and sets its table property to “PatientTable”

PatientRelationDetails

Now Right click on relation click on new =>ForeignKey=>Single field AlternateKey based

AlterNativeField

 

 

A new field added against  relation, rename it to PatientNumber

PatientKey

 

Similarly create another key based DiagnosticTable

AdmissionTableWithRelation

 

 

Save and compile all table and synchronize each table.

 

Form development will be on next post

« Previous Page
Next Page »

Primary Sidebar

About

I am Dynamics AX/365 Finance and Operations consultant with years of implementation experience. I has helped several businesses implement and succeed with Dynamics AX/365 Finance and Operations. The goal of this website is to share insights, tips, and tricks to help end users and IT professionals.

Legal

Content published on this website are opinions, insights, tips, and tricks we have gained from years of Dynamics consulting and may not represent the opinions or views of any current or past employer. Any changes to an ERP system should be thoroughly tested before implementation.

Categories

  • Accounts Payable (2)
  • Advance Warehouse (2)
  • AI (3)
  • Asset Management (3)
  • Azure Functions (1)
  • Books (6)
  • Certification Guide (3)
  • ChatGPT (3)
  • Claude (1)
  • Customization Tips for D365 for Finance and Operations (64)
  • D365OF (60)
  • Data Management (1)
  • database restore (1)
  • Dynamics 365 (59)
  • Dynamics 365 for finance and operations (139)
  • Dynamics 365 for Operations (175)
  • Dynamics AX (AX 7) (134)
  • Dynamics AX 2012 (274)
  • Dynamics Ax 2012 Forms (13)
  • Dynamics Ax 2012 functional side (16)
  • Dynamics Ax 2012 Reporting SSRS Reports. (31)
  • Dynamics Ax 2012 Technical Side (52)
  • Dynamics Ax 7 (65)
  • Exam MB-330: Microsoft Dynamics 365 Supply Chain Management (7)
  • Excel Addin (1)
  • Favorites (12)
  • Financial Modules (6)
  • Functional (8)
  • General Journal (1)
  • Implementations (1)
  • Ledger (1)
  • Lifecycle Services (1)
  • Logseq (4)
  • Management Reporter (1)
  • Microsoft Excel (4)
  • MS Dynamics Ax 7 (64)
  • MVP summit (1)
  • MVP summit 2016 (1)
  • New Dynamics Ax (19)
  • Non Defined (9)
  • Note taking Apps (2)
  • Obsidian (4)
  • Personal Knowledge Management (3)
  • PKM (16)
  • Power Platform (6)
  • Procurement (5)
  • procurement and sourcing (6)
  • Product Information Management (4)
  • Product Management (6)
  • Production Control D365 for Finance and Operations (10)
  • Sale Order Process (10)
  • Sale Order Processing (10)
  • Sales and Distribution (5)
  • Soft Skill (1)
  • Supply Chain Management D365 F&O (5)
  • Tips and tricks (278)
  • Uncategorized (165)
  • Upgrade (1)
  • Web Cast (7)
  • White papers (4)
  • X++ (10)

Wiki

  • SCM

Copyright © 2026 · Magazine Pro On Genesis Framework · WordPress · Log in