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

Can we get multiple form controls in one extension class like in [extensionOf(formStr())]?

(0) ShareShare
ReportReport
Posted on by 206

Hi experts,

Actually, I wanted to get rid of creating multiple formControl extension classes. For suppose, I have added three buttons on a standard form and I need to write clicked method for each of that button so, for now I am creating multiple formControlStr extension classes. I need to get rid of these classes and need to write clicked method in one extension class. Is it possible?

Note: I do not need it to do in an eventHandler class. 

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

    Hi Arif Hussain,

    I think this is not possible. Basic syntax of the COC will be decorating the extension class with the name of the element where you are extending. For example if your are writing COC for control 1 you will mention the name of control in the attributes using formControlStr(FormName, Controlname). As you see you need to specifically mention the name of the control then only the system will understand this clicked method will belong to that control.

    So you cannot create one extension class for all the controls.

    Thanks,

    Girish S.

  • Arif Hussain Profile Picture
    206 on at

    Hi GirishS , Thank you. I really appreciate your response.

    Btw, don't you think that we should get all controls and datasources in formExtension as in standard forms we get all things in one class?

    Is Microsoft working on this?

    Regards,

    Arif Hussain

  • GirishS Profile Picture
    27,827 Moderator on at

    No, which standard class has all the controls and datasource extension in one class?

    I don't think this is possible - If you are writing COC for datasource - You can add all the override method and your custom method inside that class particular to that datasource only - Also you cannot add the control level extension codes in the datasource extension class.

    Thanks,

    Girish S,

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Arif, you can log your idea at Dynamics 365 Application Ideas (or vote for it if it's already there).

  • Arif Hussain Profile Picture
    206 on at

    Hi GirishS , thank you again for your response. 

    I mean if we create a new form there we can use the datasources and control in one class. So why not in a form extension class?

    Below is the image attached for clear understanding.

    pastedimage1674040792858v1.png

  • GirishS Profile Picture
    27,827 Moderator on at

    Oh, currently this is not possible in extension classes where you can club all the methods..

    It must be separate class for each elements or controls in the form.

    As Martin Drab mentioned you can create an idea in the ideas portal.

    Thanks,

    Girish S.

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 611 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