Category Archives: Dynamics AX 2012 R3 CU8

How to select multiple records from lookup-Part-1(SysLookupMultiSelectCtrl)

Today i would share how to create a lookup to select multiple items in Dynamics AX 2012 forms.

In normal lookup methods we can only select one item at a time but in AX 2012 has introduced new class SysLookupMultiSelectCtrl to achieve the same without any hassle.

There are multiple ways to achieve the same but today i will demonstrate how can we have a site lookup with provision to select more then one item selection on parameter form in dynamics ax.

Multiselect lookup.png


  1. Create a Query named InventSiteQR that will contains data source e. InventSiteas shown in the below figure.

QueryMultiple lookup.PNG

2.Create the control on the form, set the auto declaration property to yes

Multiselect lookup

3.Declare instance of class SysLookupMultiSelectCtrl In the Class Declaration of the form:

public final class FormRun extends ObjectRun
 SysLookupMultiSelectCtrl msCtrlSite;


4.Write below code in the Init method of the form:

public void init()
 msCtrlSite = SysLookupMultiSelectCtrl::construct(element, SplitCostingProd, 
querystr(InventSiteQR),false, [tableNum(InventSite), fieldNum(InventSite, SiteId)]);

5.Add new field container type on parameter table named InventSiteCon

6.Write below code on the active method of form parameter table data source to update the control on load of the form:

public int active()

7.Write below code on the modified method of form control to get the selected record values from lookup and update those values to parameter Table:

public boolean modified()
 boolean ret;
 container conSite;
 RefRecId recid;
 int i;
 InventSite inventSite;
 container roleIds, roleNames;

 ret = super();
 conSite = msCtrlSite.get();
 for(i = 1;i<=conLen(conSite);i ++)
 recid = conPeek(conSite,i);
 select firstOnly inventSite where inventSite.RecId == recid;
 roleIds += inventSite.RecId;
 roleNames += inventSite.SiteId;
 ProdParameters.InventSiteCon = [roleIds,roleNames];
 return ret;


Thats it. Happy Daxing 🙂


Tags: , , , , , ,

Disable Form grid column automatic sorting feature

I have been asked by customer to enable sorting only on one field and one should not be able to sort by using other grid fields/controls.

in simple words he wants me to disable automatic sorting feature on other fields on grid except one so that when the user clicks the column header, the order displayed would not change.

i found dynamics community conversation to achieve this quick manner.I have added an override method sort() on each grid control where i wants to disable automatic sorting and also blocked super.

sort method


public int sort(SortOrder _sortDirection)
 int ret;

 //ret = super(_sortDirection);

 return ret;


Happy Daxing 🙂

References :
How can I disable the automatic sort on the grid?
Preventing users from sorting a grid


Tags: , , , , ,

Fill color in Grid records based on condition flag in AX

My client requirement was to change the grid row’s color in dynamics ax 2012 on the condition basis.

There is a method displayOption() method on a form data source which can be useful to highlight particular rows on grid, based on the data in the record. displayOption() method will execute once for each record before the record is displayed on the form.

public void displayOption(Common _record, FormRowDisplayOption _options)
 #define.DeepSkyBlue(0, 191, 255)

 if (_record.(fieldnum(ProdTable,ProdStatus))==ProdStatus::ReportedFinished)

 super(_record, _options);

Happy Daxing 🙂

Reference :
Highlighting record in Grid

How to change grid row color in listpage form in Dynamics Ax 2012


Tags: , , , , , , , ,

List all the Base Enumerations in AX 2012

Today i got a requirement to traverse and list down all enumerations available in AOT. I also needed the list of all Base Enums elements with their label & value. The result was a simple but powerful script which will traverse all nodes of a Base enumerations to find all enumerations elements.

The below code will populate the list of of Base enumerations under AOT node.
static void Job_ListBaseEnumObjects(Args _args)
// #AOT is defined in the AOT under Macros.
TreeNode treeNode;
EnumId enumId;
Counter counter;
SysDictEnum sysDictEnum;
BaseEnumList baseEnumList;

treeNode = TreeNode::findNode(#BaseEnumsPath);
treeNode = treeNode.AOTfirstChild();
sysDictEnum = new SysDictEnum(enumName2Id(treeNode.treeNodeName()));
baseEnumList.BaseEnumID = enumName2Id(treeNode.treeNodeName());
baseEnumList.BaseEnumName = treeNode.treeNodeName();
baseEnumList.ElementCount = int2str(SysDictEnum.values());
for (counter=0;counter<SysDictEnum.values();counter++)
baseEnumList.BaseEnumID = enumName2Id(treeNode.treeNodeName());
baseEnumList.BaseEnumName = treeNode.treeNodeName();
baseEnumList.ElementLebel = SysDictEnum.index2Label(counter);
baseEnumList.ElementValue = int2str(SysDictEnum.index2Value(counter));
treeNode = treeNode.AOTnextSibling();

I extracted table data in excel after pressing CTRL+T on browsed table.

Base Enums

Happy Daxing 🙂


The Model Store has Been Modified &The number sequence for party records is not set

Yesterday I was  preparing an AX enviornment with an upgrade of AX 2012 RTM to CU8 and CU9 and found myself having a strange issue.

I have installed Dynamics AX 2012 RTM with slipstreaming of CU8 and CU9 and imported the home made vertical model on the same.As part of the upgrade you need to complete a checklist including such things as Compile application and detect conflicts.

When I opened the environment first time after importing the model then after upgrading Microsoft Dynamics AX 2012 you will get the following dialog upon starting the AX client:


When I have performed the appropriate upgrade actions (AOT compile, code check, CIL compile, synchronize, upgrade scripts), the dialog still might pop up every time you start the client. Selecting “Skip” was not solved this.I run  through all these processes multiple times but everytime i was getting the same dialog popup “The Model Store has Been Modified“.

I installed AX on single server with AX 2012 R3+CU8+CU9.I also compiled application with client and AXBuild for Parallel Compile on AOS of X++ to p-code and  also had synchronized the client via database and via AOT.

I googled multiple places and found few solution to get rid of this dialog popup like

Solution 1 :AXUTIL set /noinstallmode which prevents the AX client initialization checklist

Solution 2:If you can access SQL server open SSMS locate ReleaseUpdateConfiguration Table update the column MinorUpgrade “One” to “Zero”.

Solution 3:

a)Prevent the dialog from appearing by clicking
System administration > Setup > Checklists > Prevent startup of checklist

b)Even after above steps still the pop up is coming then write a job containing this line


I have tried all mentioned option which  helped me get rid of this popup but does not solved my problem.when i started opening user interface(forms) then i started getting another  error message in every module of AX. when i again tried to perform checklist:(

“The number sequence for party records is not set”

Now again I thought to perform Compile,CIL and Synchronize but doesn’t matter how many times I compile, CIL compile or sync (successfully),the error remain same and checklist remains saying that these items still need to be completed.I also spent so many hours to resolve this but no success.

I found an blog which clarified the reason  to solve ‘The number sequence for party records is not set.’. It only appear after when we import the ISV, VAR and USR models.

Root cause:It turns out the offending code was in the ISV model(Campus Nexus) in the startupPost() method on the Info class.our ISV model has a piece of code changes application behavior during startup.

Inside the startupPost() and startup() method was a find method that selects Table SYSSetupLog  which contains status information of initialization checklist and application wasn’t able to update the same for compile,CIL and Synchronization.So Kernel was considering model store is dirty. its little hard to digest.


1.Truncate the SysSetupLog table from SQL using DELETE FROM SYSSETUPLOG).

2.Create the following job and run it inside AX:



This job is saving a record SysCheckList_Upgrade with description status Finished  in Table SysSetupLog because AX 2012 R3 CU9 Data Migration/Upgrade did not correctly set the SysCheckList_Upgrade SysSetupLog entry to Finished, but it is Executed.

3.Restart AX Services and Issue Resolved. 🙂

I will explore little more and will update on same page if found something.for me its solved the problem time being.

Special Thanks for below articles which helped me to solve my issue.for more details please refer below articles links :

Number sequence error when starting the Upgrade checklist

The Model Store Has Been Modified – AX2012 R3 CheckList

The Model Store has Been Modified – AX2012 R3 CheckList Issue

The model store has been modified

Happy Daxing 🙂


Change Dynamics AX Client Installation Directory

I was trying to find some way to  move our dynamics AX installation directory to our local C drive from our local D drive which i mentioned at the time of installation.

Initially when i installed AX 2012 client system that time system prompted me to select the file location and i changed the default location C:\Program Files (x86)\Microsoft Dynamics AX\60 to D:\Program Files (x86)\Microsoft Dynamics AX\60.

I had also completely uninstalled  AX client and then i reinstalled again but I didn’t get the prompt for the file location. after lots of research i found this is getting stored in the registry in HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Dynamics \ 6.0 \ Setup \ Components \ InstallDir32

its has saved path D:\Program Files (x86)\Microsoft Dynamics AX\60.

I performed below steps to change Dynamics AX Client Installation Directory

1.Uninstall AX client

2.Change HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Dynamics \ 6.0 \ Setup \ Components \ InstallDir32 to C:\Program Files (x86)\Microsoft Dynamics AX\60

3.Install AX client again,Now system will save client on C drive.


Happy Daxing 🙂


Cannot select a record in Students (CMCStudent). Name: 0. The SQL database has issued an error.

I have imported a model in Microsoft Dynamics AX 2012 R3 CU9 enviornment and model was imported successfully without any error but when i tried to open customized table or form developed in new Model then it throws me an error

Cannot select a record in Students (CMCStudent). Name: 0. The SQL database has issued an error.

when i executed query at SQL of database MicrosoftDynamicsAX then found table CMCStudent does not exists that why AX tries to access table CMCStudent that does not exist in DB yet.

I googled multiple places and everyone suggested to perform “Administration – Periodic – SQL administration – Table Actions – Synchronize database” but its didn’t work for me.


1.Administration – Periodic – SQL administration – Table Actions –Select Table->Generate SQL scripts->…. for creating tables.

it will generate a script that you can use to add the selected tables to the database

SQL Error1.PNG


2.Execute SQL script generated by step 1 on Dynamics AX database

sql error 2.PNG

3.Now restart AX service and try to open form related to table or browse table.You will be able to open table without any error.


Happy Daxing. 🙂