Skip to main content

Notifications

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 159

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. 

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Can we get multiple form controls in one extension class like in [extensionOf(formStr())]?

    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.

  • Arif Hussain Profile Picture
    Arif Hussain 159 on at
    RE: Can we get multiple form controls in one extension class like in [extensionOf(formStr())]?

    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

  • Martin Dráb Profile Picture
    Martin Dráb 230,817 Most Valuable Professional on at
    RE: Can we get multiple form controls in one extension class like in [extensionOf(formStr())]?

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

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Can we get multiple form controls in one extension class like in [extensionOf(formStr())]?

    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,

  • Arif Hussain Profile Picture
    Arif Hussain 159 on at
    RE: Can we get multiple form controls in one extension class like in [extensionOf(formStr())]?

    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

  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Can we get multiple form controls in one extension class like in [extensionOf(formStr())]?

    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.

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

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans