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, ...
Suggested Answer

How to get the Customer name from linked Customer Account in a extended form?

(0) ShareShare
ReportReport
Posted on by 668

Hi Experts,

I'm working with an extended form where I need to add some extended fields and their descriptions.

I'm facing an issue while adding the description fields in the form as they need these fields for filtering so cannot create a display method, like example I have to provide a customer name in a field for customized field customerFrom which extends CustAccount Edt. So when user clickes on CustomerFrom field the assocaited customer name should be populated in another field.

Likewise HCM worker name with selected HCWWorkerID.

Note: Display method is not required as these fields are require for filtering purpose.

How can I achieve this?? Do I need to add all the datasources in a form? But then how can I link these datasources with the other fields?

Please guide me. Thanks in advance!!

I have the same question (0)
  • GirishS Profile Picture
    27,827 Moderator on at

    Hi,

    You need to add code in the modified field method of "CustomerFrom" field. Based on the selection of the customer account you add the select statement and populate the description field.

    Thanks,

    Girish.

  • Suggested answer
    Pete Alberts Profile Picture
    3,542 on at

    Hi Avatar.

    If the customer requires filtering then you cannot use display methods. You will need to add a DS (and join it properly) to the form extension which contains the field that you require.

    If the form has a datasource CustTable, then you can add a DS DirPartyTable, join the DS to the CustTable DS and then use the Name field on the DirPartyTable DS.

    You should be able to manage with that information. Nonetheless, I can specify it in smaller steps if you continue to struggle.

  • D365FO Avatar Profile Picture
    668 on at

    Hi Pete Alberts,

    I was extending All work order form, where CustTable Ds is not present I have added CustAccountName view in the extended form but I need to give customer name to 2 different fields example CustAccountFrom and CustAccountTo.

    Please help me how can I join this Ds with main ds and fetch the description.

  • D365FO Avatar Profile Picture
    668 on at

    Hi Girish,

    I have added CustAccountName view in the form and trying to use Name field of it.

    For this I'm calling modified method through event handler for the CustAccountFrom field and trying to write the logic but Could you please explain it more how can I populate the description

  • GirishS Profile Picture
    27,827 Moderator on at

    Hi,

    On which table your are saving the "CustAccountFrom" field value?

    on the "onModifiedEventHandler" method,

    1. You need to get the form run from the form control(get form run from arguments which is sender")

    2. From form run you will get the form datasource where the "CustAccountFrom" field will be present.

    3. From form datasource you will get the current record and assign the description for customer account using the select statement.

    Thanks,

    Girish S.

  • D365FO Avatar Profile Picture
    668 on at

    [FormControlEventHandler(formControlStr(EntAssetWorkOrderTable, WorkOrderTable_xyz_CustomerAccountFrom), FormControlEventType::Modified)]
        public static void WorkOrderTable_xyz_CustomerAccountFrom_OnModified(FormControl sender, FormControlEventArgs e)
        {
            FormRun             element = sender.formRun();
            FormDataSource      fds = sender.formRun().dataSource(formDataSourceStr(EntAssetWorkOrderTable,WorkOrderTable));
            EntAssetWorkOrderTable       workOrderTable = fds.cursor() ;
            FormDataSource      fds1 = sender.formRun().dataSource(formDataSourceStr(EntAssetWorkOrderTable,CustAccountName_From));
            CustAccountName       custAccountName = fds1.cursor() ;
            FormControl        custAccountNameFrom = element.design(0).controlName('CustAccountFromName');
    
            custAccountName.Name = CustTable::find(workOrderTable.xyz_CustomerAccountFrom).name();
        }

    I have done like this but its not working.

    I have added CustAccountName view in the form and which link type should I use ?

    Please tell me where I m wrong.

  • GirishS Profile Picture
    27,827 Moderator on at

    Why do you need CustAccountName view in the form datasource?

    You can create one description field in the "EntAssetWorkOrderTable" table and assign values to that field on the modified method based on the selection of "CustAccountFrom" field.

    Thanks,

    Girish S.

  • D365FO Avatar Profile Picture
    668 on at

    Yes, but I don't have to add any description field in the table.

    I have to use the standard field and link that field with custAccountFrom.

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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans