How to find form data sources through X++


Can anyone help me,

How to find certain form datasources through code.

for example if I select CustTable, normally we expand datasource it shows all tables name.

how can find those table and queries through X++ code.

Thanks in Advance.


Unfortunately I’m not sure what exactly you need. Could you please describe your specific scenario?

Thank you Martin

when I open any standard form in the AOT, automatically that particular form Data Sources will be displayed in INFO message or in other form.

for example if I select CUSTTABLE form automatically display the custtable Data Sources in other form or INFO message

not only custtable any Form in AOT, it will display that form Data Sources.

Thank you

Nope, I didn’t decipher it. Try to be specific rather then trying to deal with abstractions.

Hi Martin,

This is Example for only CUSTTABLE, But my scenario is If I Open any form, that form DataSources (list of tables) open in Info…

static void AllDataSourcesInForm(Args _args)
Args args = new Args();
FormRun fr;
FormBuildDataSource formBuildDataSource;
counter i;
;“CustTable”); // its your FORM name
fr = ClassFactory.formRunClass(args);
for(i=1 ; i<=fr.form().dataSourceCount();i++)
formBuildDataSource = fr.form().dataSource(i);
info(new DictTable(formBuildDataSource.table()).name());

I think so my question is clear to you…

End user open any Form , it shows that form DataSources(List of Tables or Queries)

I am Using AX2012R3

Thank you.

Does it mean that your code does what you want but you would like to run it automatically when you open any form?

It would help me to understand your question if you actually asked a question. You just described a solution and I have to guess what’s your problem.

By the way, are you aware of that you can see data sources if you right-click any form, choose Personalize and then switch to the Query tab?

Thank you so much Martin.

If a reply answers your question, please mark it as the verified answer.