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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to link multiple data source and use in list page grid in an extended form

(0) ShareShare
ReportReport
Posted on by

Hi experts,

I want to link multiple data sources in an extended data source and use there fields in the form as well.

Like example I want to get customer name from custTable and show this field in the list grid page.

Thanks in advance!!

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Aimon,

    Could you please share which form you are trying to extend to add customer name from CustTable?

  • Community Member Profile Picture
    on at

    I have to add fields of customer name from DirpartyTable in list page and link it with customized Customer account field from EntAssetWorkOrderTable.

    So instead of using CustTable and DirpartyTable, I'm using a view- CustAccountName and added in the extended datasource.

    When I m making  link type as outer join with the work order table, the reference of Work order id is going and only the last record is opening.

    To solve this issue I was thinking to make the join through code

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    For the customized Customer account field in EntAssetWorkOrderTable, did you create a relation with CustTable? If not, can you try creating this relation and see if it works?

    You also might not need a view for displaying the name. You can use the existing display method - name in the list page to display customer name.

  • Community Member Profile Picture
    on at

    Yes, CustTable relation already created for the customized field.

    This is the requirement of the client to filter the customer name so we can't use display method.

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Ok. In that case, you can create a CoC on init method of CustAccountName datasource and link it to EntAssetWorkOrderTable table using addLink. 

    this.queryBuildDataSource().addLink(fieldNum(EntAssetWorkOrderTable , CustAccount), fieldNum(CustAccountName , CustAccount));

    You can replace the field names and object names as per you customization.

  • Community Member Profile Picture
    on at

    QueryBuildDataSource    qbds;
    FormDataSource          custAccName_ds = this.query().dataSourcename('CustAccountName');
    qbds = custAccName_ds.queryBuildDataSource();
    qbds.clearDynalinks();
    qbds.addlink(fieldnum(EntAssetWorkOrderTable, xyz_customeraccountFrom),fieldNum(CustAccountName, AccountNum));
    qbds.joinMode(JoinMode::OuterJoin);

    I have tried in init() method, but error is coming while opening the form like the data source is not embedded with parent datasource.

    Could you please help me the correct code, because I have tried many times but somewhere it's lacking.

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    For the outer join, you can mention it on the datasource only. You can check the standard form Hcmi9Document. In this form view 'DirPartyPostalAddressView' is used. The properties "Join source" and "Join type" are mentioned in the datasource properties.

    pastedimage1642511653418v1.png

    In the datasource init method, the link is mentioned

    pastedimage1642511703129v2.png

    You can do the same thing on your form.

  • Community Member Profile Picture
    on at

    class xxx_EntAssetWorkOrderTableFrm_EventHandler
    {
        public void workOrderId_OnJumpRef(FormDataObject _target)
        {
            Args args = new Args();
     
            args.record(_target.datasource().cursor());
     
            args.caller(_target.datasource().formRun());
    
            args.menuItemName(menuitemDisplayStr(EntAssetWorkOrderTable));
    
            new MenuFunction(menuitemDisplayStr(EntAssetWorkOrderTable),MenuItemType::Display).run(args);
     
        }
    }

    [ExtensionOf(formstr(EntAssetWorkOrderTable))]
    final class xxx_EntAssetWorkOrderTableFrm_Extension
    {
    
        /// 
        ///
        /// 
        /// 
        /// 
        [FormDataSourceEventHandler(formDataSourceStr(EntAssetWorkOrderTable, WorkOrderTable), FormDataSourceEventType::Initialized)]
        public static void WorkOrderTable_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)
        {
            var workOrderHandler = new xxx_EntAssetWorkOrderTableFrm_EventHandler();
    
            sender.object(fieldNum(EntAssetWorkOrderTable, WorkOrderId)).registerOverrideMethod((methodStr(FormDataObject,jumpRef)),
                methodStr(xxx_EntAssetWorkOrderTableFrm_EventHandler,workOrderId_OnJumpRef),workOrderHandler);
        }
        
    }

    Thank you for sharing the screenshots.

    I did the same thing as you mentioned above but my scenario is this customer name field from another data source needs to add in list grid as well. Work Order is a "Detailed Transaction" form pattern, so adding this Data Source and making join type as "Outer join"  the linking of these two data source is working fine but the reference of "Work order Id" is gone.

    Means- When I'm clicking on any record in All work order form, only the last record is opening.

    I have tried to write jump ref as well, but this method is not triggering.

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    I don't think you need jumpRef method.

    In the form EntAssetWorkOrderTable, are there any other customizations? I can see a field CustAccount in WorkOrderTable. Are you trying to display the customer name based on the value in this field?

  • Community Member Profile Picture
    on at

    Yes, you are right there is a standard custAccount field, but I have to show the name of other extended fields names xyz_CustomerAccountFrom and xyz_CustomerAccountTo.

    So what should I do?

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans