Skip to main content



No record found.

Microsoft Dynamics AX forum

Adding data source to AOT query by code

Posted on by 11,871

I am trying to adjust AOT query during the run time by adding extra data source   by it does not work , If I try to build the whole query during the run time it works , how can I adjust the AOT during the run time  ?

  • Martin Dráb Profile Picture
    Martin Dráb 225,783 Super User on at
    RE: Adding data source to AOT query by code

    Unfortunately we can't tell you what you did wrong unless your give us more information than just that "it does not work".

    You can't change the AOT at runtime, but you surely can load the AOT query to a Query object and modify this object. For example:

    Query query = new Query(queryStr(MyAotQuery));
    QueryBuildDataSource existingDs = query.dataSourceTable(tableNum(TableA));
    QueryBuildDataSource newDs = existingDs.addDataSource(tableNum(TableB));

    By the way, which version of AX are you talking about? If it's D365FO, please ask such questions in D365FO forums (such as Dynamics 365 Finance Forum).

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,459 Super User

Martin Dráb Profile Picture

Martin Dráb 225,783 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans