Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Adding a new datasource to a form

(0) ShareShare
ReportReport
Posted on by 700

Hi community,

I have a question how to add a new data source to a standard ax form with relations to the exisiting data sources.

I have a form with a standard template that have one main datasource and three other data sources. I need to add a datasource that is connected to one of the three tables and not the main table. I miss setting a relationship like we do in a query. Where can I look up an example to do it? 

Can I add a datasource only setting properties or do I need to set relations between two tables in code?

Thank you all

*This post is locked for comments

  • OrangeRocks Profile Picture
    700 on at
    RE: Adding a new datasource to a form

    Thanks for suggestions. I tried it but I need to add a datasource that will be linked to the second data source.

    EDIT[]

  • Verified answer
    Chaitanya Golla Profile Picture
    17,225 on at
    RE: Adding a new datasource to a form

    Hi,

    For suppose if you have TableA(parentTable) and TableB(ChildTable). If both tables have relation defined at the table level, then you set properties JoinSource and LinkType on TableB. If their is no pre-defined relation/relate based on other condition, then you can make use of addLink method.In the init method of TableB include following code:

    public void init()
    {
        QueryBuildDataSource qbds;
        
        super();
        
        qbds = this.query().dataSourceTable(tableNum(TableB));
        qbds.addLink(fieldNum(TableA, CommonField), fieldNum(TableB, CommonField));
    }

    Refer below link:

    (QueryBuildDataSource.addLink Method [AX 2012])

    msdn.microsoft.com/.../querybuilddatasource.addlink.aspx

  • Suggested answer
    Mahmoud Hakim Profile Picture
    17,887 on at
    RE: Adding a new datasource to a form

    you can follow this steps

    msdn.microsoft.com/.../aa608858.aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,140 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,895 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans