RecordLinkList in Dynamics AX [X++]

In this post, I am going to explain RecordLinkList class which will help the developer to dynamically create a cache of record-buffers. A recordLinkList works as a double linked list that can hold records of different tablebuffers at the same time.

The recordLinkList is particularly useful for passing records from different tables as a parameter instead of retrieving the same records again.

There is no size limit of a recordSortedList, developer can control its size and its memory consumption

static void SR_RecordLinkListExample(Args _args)
RecordLinkList rll;
CustTable custTable;
VendTable vendTable;
EmplTable emplTable;

boolean toIterate;
rll = new recordLinkList();

select firstonly custTable;
select firstonly vendTable;
select firstonly emplTable;


toIterate = rll.first();

custTable = null;
vendTable = null;
emplTable = null;

while (toIterate)
case tablenum(custTable): custTable = rll.peek(); break;
case tablenum(vendTable): vendTable = rll.peek(); break;
case tablenum(emplTable): emplTable = rll.peek(); break;
toIterate =;

info (custTable.AccountNum +’,’ + vendTable.AccountNum + ‘,’ + emplTable.emplId);

Create Progress bars in Dynamics AX [startlengthyoperation, SysOperationProgress,Animations ]

This post is again useful for those developers who are new to X++ programming and would like to use progress bars or Hour glass indicators while some business logic is running, hinting the user that something is happening in the background.
Use a progress indicator during operations that take more than 2 seconds.
Use an hourglass mouse pointer if the process takes 2-7 seconds.
Use a progress bar if the process takes 8 seconds or more.
There are many ways to display operations in progress
1) Hourglass Indicators
2) Progress Bars
3) Progress controls on the forms
4) Animate Controls

Hour Glass Indicators Example:

Use startlengthyoperation() and endlengthyoperation() between ur business logic
Example :

static void HourGlassMousePointer(Args _args)
int i;
str value;

for( i = 1; i <= 200000; i++)
value += int2str(i) + ','; // some business logic


Below is how the hourglass indicator looks

2) Use SysOperationProgress class to show the progress Bars

Initialize a SysOperationProgress variable.

Set a caption for the form by using the SysOperationProgress.setCaption method.

Set an animation to run while the operation is in progress by using the SysOperationProgress.setAnimation method.

A number of animations are provided with Microsoft Dynamics AX. To view them, run the Tutorial_ShowAVIFiles class. If you use one of these animation files, you need to declare the AviFiles macro at the top of your code.

Specify the total number of operation steps.
This is needed for the time-remaining calculation. If you do not set the total number of operation steps, the progress indicator is not shown. The total is often a count of the number of records, and may be time-consuming to calculate. Don't specify the total if the time is taken to calculate the records is comparable to the total time taken for the operation.

Perform the operation. For each step, specify a description and a step number.
During the execution, the progress indicator is updated accordingly. The estimated time remaining is calculated and displayed.
The default update interval is 3 seconds. If the task of updating the display takes more than 10% of the update interval due to latency on the network connection, the update interval is increased by 1 second.

Example :

static void operationProgress_progressBars(Args _args)
SysOperationProgress progress = new SysOperationProgress();
int i;


progress.setCaption("Progress bar example…");
for (i = 1; i <= 50000; i++)
progress.setText(strfmt("The value of i is %1", i));
progress.setCount(i, 1);

Below is the output:

3) Use progress control on the form
Create a new progress control and change the autodeclaration property of the progress control to yes as shown in the figure.

In the init() or run() method of the form modify the code as shown below.

SysDictClass dictClass;
int i;
int classCount;
classId classId;
Dictionary dictionary;

dictionary = new Dictionary();
classCount = dictionary.classCnt();


for (i=1; i <= classCount; i++)
dictClass = new SysDictClass(dictionary.classCnt2Id(i));

4. Finally Animations: we can use Animations to let the end users know that process is running at the back ground.
We can use Animate controls to show the progress. Create a new form and add a animate control as shown below. Change the autoDeclaration property of the animate control to Yes

Override the run() method and paste the below code
public void run()
int i;
for (i = 1 ; i <= 10000; i ++)
Animate.animateFile(#AviPrint);; // autoplay(true);


Below is the output

Please note: Progress bars are inbuilt in runbase frameworks

Happy daxing…..