AX2012/D365FnO – HOW TO CREATE A AOT STATIC QUERY USING MULTIPLE TABLES

D365fno-PostImage

In this blog post, I will show you how to create a simple AOT query using multiple tables in D365FnO

AOT queries allow you to define the data sources, fields, filters, and joins that you want to use in your reports, forms, or custom code. You can also use AOT queries to create views, which are virtual tables that can be accessed by other queries or code.

To create a query in D365FnO, you need to follow these steps:
1. Open Visual Studio and connect to your development environment (Model).
2. In the Solution Explorer, right-click the project and select Add > New Item.
3. In the Add New Item dialog box, select Dynamics 365 Items > Data Model > Query and enter a name for the Query.
4. Click Add to create the Query.
5. In the Query Designer, right-click on the Data Sources node and select New Data Source.
6. In the Properties window, select the Table property and choose a table (CustTrans) from the drop-down list. This will be the primary data source for your query.
7. Select the 2nd table (CustSettlement) from the Table property and also set the others highlighted properties. 

8. To add filters to your query, right-click on the Range node. In the Properties window, enter a field name and a value expression for your filter. You can use operators such as =, <>, >, <, >=, <=, like, not like, etc.
9. To specify the join condition, right-click on the Relation node and click New Relation option. In the Properties window, Select the primary JoinDataSource table (CustTrans) from drop-down and select a Field (Parent) and Related Filed (Child) from both tables that have matching values.

10. Save your query and Build/Rebuild the project.

You have now created a basic AOT query in D365FnO that you can use in your reports, forms, or custom code. You can also modify your query by adding more data sources, fields, filters, or joins as needed.
I hope this blog post was helpful and informative for you. Share with others and spread knowledge.
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.