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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Disable custom FormMenuButtonControl on form

(0) ShareShare
ReportReport
Posted on by 209

Hi Community Experts,

I have a requirement where I need to disable a FormMenuButtonControl, it is a custom button coming from a different model.

pastedimage1665994059305v3.png

pastedimage1665994112269v4.png

I need to disable it on the Applications form inside Human Resource module.

But I am unable to get this control in the event handler, I am writing this inside On_Activated event handler of form data source.
pastedimage1665993921539v1.png

But its returning an error that no such control exists on Form.

I tried with CoC as well, but its not working.

pastedimage1665994005323v2.png

Looking forward to usual helpful responses on it.

Best Regards

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

    Hi Chota Hukam,

    You can also create label id for control name and use it in your code. Like below.

    [FormDataSourceEventHandler(formDataSourceStr(FormName, TableName), FormDataSourceEventType::Activated)]
    public static void TableName_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
    {
        FormRun frun = sender.formRun();
        FormMenuButtonControl menuButton = frun.design().controlName("label Id You have created for the control") as FormMenuButtonControl;
        menuButton.visible(false);
        
    }

    Thanks,

    Girish S.

  • Suggested answer
    Martin Dráb Profile Picture
    238,406 Most Valuable Professional on at

    Maybe there is none - it's just your speculation that such a macro exists.

    Look into the model that adds Dox42SystemDefinedButton to see whether the developer hard-coded the name, used a macro or a constant.

    If you can't look into code, you can still look at model definitions to AOT, e.g. to know whether there is an AOT macro.

    If you don't find anything, create a constant by yourself.

  • alinawaz Profile Picture
    209 on at

    goshoom How can I check which Macro to refer here ?

    Its a different model altogether, I am not aware of its elements.

  • Martin Dráb Profile Picture
    238,406 Most Valuable Professional on at

    The first code snippet fails because no such control is available in the definition of HRMApplication form - it's added at runtime.

    In the second code snippet, you're referring to a macro that you haven't defined anywhere in your class. The standard macro (SysSystemDefinedButtons) can't contain custom controls.

  • Arunraj Rajasekar Profile Picture
    1,743 on at

    Have you included the other model where the menu item was created as a reference model in your model?

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 843 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 323 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans