‘Select all’ ctrl-A is selecting only 20 records in the Form grid

There is an issue with the Grids in Ax 2012 where select all or ctrl A or clicking top check box in the grid, selects only 20 records and if you want to iterate or check the number of records through code, it will always show 20 even though the records are more than 20 in the Grid.

The reason behind is, the Grid control in Ax does not load all the records on the initialization of the Form, if the records are more than 20 and user has to scroll the whole grid to make Ax select all the records and to get the correct count in the code.

The more technical explanation of this could be, there are only 20 records marked when the user clicks the top check box in the Grid and to get all the records, code has to mark all the records by iterating through all the rows in the Grid. Something like below

recordsCount = student_ds.recordsMarked().lastIndex(); // Total no of marked records.

studentLocal = student_ds.getFirst(1);

while (studentLocal)


info(studentLocal.Name +" " +studentLocal.ID);

studentLocal = student_ds.getNext();


User can manually press Ctrl + Shift+ End to select all the records. I also tried passing this key strokes through the code but the key strokes didn’t work through code. The key stroke for Ctrl + Shift+ End is 2824.

More helpful Links can be found below


How to check user has applied filter on the records or not


A very helpful link with examples can be found below


How to check user has selected all the record using the top check box in the grid

How to check user has selected all the record using the top check box in the grid

TestTable_ds.defaultMark() method can tell you if the user has selected all the records in the grid on the Form or not

How to get company fiscal calendar



How to make field readonly in web service


I have a bug in web service where we need to make a parameter read. There is a code in validateWrite(..) method of the table that adds an AIFFault::checkFailedLogFault if the field is being changed.However, when testing this using the web service in the visual studio solution no error is being raised and the web service is being allowed to change parameter even though when I step into debug the AIFFault::checkFailedLogFault is being called.


There are four ways to achieve this through x++ code. There is nothing that web service can do to make visual studio or any other client stopped editing, because web services are asynchronous in nature and web services are not called on the assignment of the value in any client ( I believe user is associating project to the lines from the client and not the code behind web service is doing that). It will raise error when the client submit the code and will fail the creation of the record in case of any error.

1) Write the code on the validate write of the table and return false from there with the checkFailed error message.

2) Delete the field from the query so that user can’t see that field.

3) Manipulate through code in the prepareForSaveEntended method of the Axd class and check if there is a project, blank the field or ignore the user value and use the table value.

4) Use the removeFieldAsTouched() method


How to add reference group control through code


FormReferenceGroupControl testReferenceControl = Grid.addControl(FormControlType::ReferenceGroup, #controlName);


testReferenceControl.referenceField(fieldNum(testDataSourceTable, testField));


How to set focus on the reference control


How to set Fact box properties through code

Hi –

Below is the example that shows how to set properties of the parts through code

int partListCounter;

PartList formPartList;

ListEnumerator partListIterator;

FormRun formPart;

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

for (partListCounter = 1; partListCounter <= formPartList.partCount() ; partListCounter++)





Get every new post delivered to your Inbox.

Join 75 other followers

%d bloggers like this: