web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to change linkType of datasource SalesTable on form SalesLineOpenOrder

(1) ShareShare
ReportReport
Posted on by 571

Hi experts,

I want to add some fields of SalesTable on form SalesLineOpenOrder, since property LinkType of form datasource SalesTable is Delay, and the added fields are not fetched. I try to change the link type through overwriting the Initialized event handler like below, but it does not work. Any suggestion is appreciated.

    [FormDataSourceEventHandler(formDataSourceStr(SalesLineOpenOrder, SalesTable), FormDataSourceEventType::Initialized),
        SuppressBPWarning('BPParameterNotUsed', 'False positive')]
    public static void InventJournalTable_OnActivated(
        FormDataSource          _sender,
        FormDataSourceEventArgs _e)
    {
        _sender.queryBuildDataSource().joinMode(JoinMode::InnerJoin);
    }

I have the same question (0)
  • Suggested answer
    EvanS Profile Picture
    2 on at
    How to change linkType of datasource SalesTable on form SalesLineOpenOrder
    Copying to a new form would work but is the more complex and less extensible solution.
     
    Earlier you said, "Unfortunately, I tried to add new datasource of SalesTable with different name, but error occurs when I try to rename." 
     
    You were getting that error because you copy/pasted the original SalesTable datasource then tried to rename it.
     
    You will get no errors if you create a new datasource, then set the properties to match the original SalesTable. Changing just the Link Type property.
     
     
  • bernardqin Profile Picture
    571 on at
    RE: How to change linkType of datasource SalesTable on form SalesLineOpenOrder

    Hi Girish,

    Sorry to say that all your suggestions are failed. I try to implement these in AX2012, and find that we can change link type between InnerJoin and OuterJoin, but cannot change it from Delay to any other link type. So I decide to copy a new form. Any way, thanks a lot.

    Disscussion is closed.

  • bernardqin Profile Picture
    571 on at
    RE: How to change linkType of datasource SalesTable on form SalesLineOpenOrder

    Thanks a lot. I will try.

  • GirishS Profile Picture
    27,825 Moderator on at
    RE: How to change linkType of datasource SalesTable on form SalesLineOpenOrder

    Also, instead of JoinMode try setting LinkType to data source.

     [FormDataSourceEventHandler(formDataSourceStr(SalesLineOpenOrder, SalesTable), FormDataSourceEventType::Initialized),
            SuppressBPWarning('BPParameterNotUsed', 'False positive')]
        public static void InventJournalTable_OnActivated(
            FormDataSource          _sender,
            FormDataSourceEventArgs _e)
        {
           sender.linkType(FormLinkType::InnerJoin);
        }

    Thanks,

    Girish S.

  • GirishS Profile Picture
    27,825 Moderator on at
    RE: How to change linkType of datasource SalesTable on form SalesLineOpenOrder

    Try the below options.

    Add your code in OnInitialized method of SalesLine datasource.

    [FormDataSourceEventHandler(formDataSourceStr(SalesLineOpenOrder, SalesLine), FormDataSourceEventType::Initialized),
        SuppressBPWarning('BPParameterNotUsed', 'False positive')]
    public static void SalesLine_OnInitialized(
        FormDataSource          _sender,
        FormDataSourceEventArgs _e)
    {
        FormRun fRun = sender.formRun();
        FormDataSource salesTable_ds = frun.datasource(formDataSourceStr(SalesLineOpenOrder, SalesTable));
        salesTable_ds.queryBuildDataSource().joinMode(JoinMode::InnerJoin);
    }

    If the above doesn't work, try to set the join mode in form init method.

    If both of them doesn't work, then you need to achieve this by adding display method. But display fields doesn't have filters.

    Thanks,

    Girish S.

  • bernardqin Profile Picture
    571 on at
    RE: How to change linkType of datasource SalesTable on form SalesLineOpenOrder

    Yes, debugger can hit this code, and the method name is changed, but does not work.

  • GirishS Profile Picture
    27,825 Moderator on at
    RE: How to change linkType of datasource SalesTable on form SalesLineOpenOrder

    Got your point. Have you debug the code? Does break point hit on OnInitailized event handler of "SalesTable" data source?

    Also noted that from your code method name is "InventJournalTable_OnActivated? Try to copy the events from the form data source and paste it in new class.

    Thanks,

    Girish S.

  • bernardqin Profile Picture
    571 on at
    RE: How to change linkType of datasource SalesTable on form SalesLineOpenOrder

    Pic1.jpg

  • bernardqin Profile Picture
    571 on at
    RE: How to change linkType of datasource SalesTable on form SalesLineOpenOrder

    I add some original fields of SalesTable to the form, but no value is shown.

  • bernardqin Profile Picture
    571 on at
    RE: How to change linkType of datasource SalesTable on form SalesLineOpenOrder

    Because the link type of salesTable_ds is delay, the salesTable common is fetched when salesLine is actived. Means that only the first one record has all values on the form. That's why I need to change the link type to InnerJoin via code.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Alireza Eshaghzadeh Profile Picture

Alireza Eshaghzadeh 799 Super User 2025 Season 2

#2
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 757 Super User 2025 Season 2

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 751 Super User 2025 Season 2

Product updates

Dynamics 365 release plans