QueryServiceClient - Unknown field name

I’m building a c#.net app that is connecting to AX 2012. I can’t modify/create objects in AX, so I’m doing Custom Queries in C# using the QueryServiceClient.

If I try to select a specific field in a normal table like “CustTable” using code like this: http://blogs.msdn.com/b/axsupport/archive/2012/02/17/calling-the-query-service.aspx
It works perfectly. But if I use the exact same code but replace the CustTable with DataArea and use a field like ID, I get the error: unknown field name: ‘ID’ Also, if I don’t specify any fields and set “DynamicFieldList” to true, it gets all the fields (including the field called ‘ID’) without any problem.

Does anyone know why there’s a problem with this particular table? The table isn’t displayed in the AOT, but it’s still an AX table and I’m able to get all fields, it’s just when you want to filter, sort or select a specific field that I get this message.

Thanks.

I found what the problem was. It has nothing to do with the table. The problem is that fields are case sensitive. They have to match the case in the AOT or Documentation (for tables that are not in the AOT). In my case, ID had to be all in lower case (id). This fixed the problem.

Thank you for posting the solution. Now it sounds obvious, but I wouldn’t have immediately realized it either.

I’m sure that the answer will help somebody sooner or later.