Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Microsoft Dynamics AX 2012 Services

You're reading from  Microsoft Dynamics AX 2012 Services

Product type Book
Published in Dec 2012
Publisher Packt
ISBN-13 9781849687546
Pages 196 pages
Edition 1st Edition
Languages

Query service


The query service enables us to retrieve data from Microsoft Dynamics AX without having to use the .NET Business Connector or, even worse, access the SQL database directly.

By using the query service, you can fetch data using any of the following query types:

  • Static query: This is used to retrieve data by using queries that are present in the AOT. We will use this type in the demonstration.

  • User-defined query: A query can also be created by using the QueryMetadata class. By doing this, you can create a query in the same way as you create queries in X++ code.

  • Dynamic query: Another way of running a query is by creating an X++ class that extends the AifQueryBuilder class. You can invoke the ExecuteQuery operation by passing in the name of the query builder class. It is also possible to pass arguments by using a class that extends from the AifQueryBuilderArgs class.

Fetching data for the grid

Now let's put some code behind the clicked event handler of the Refresh button. The idea is...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}