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

Community site session details

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

How to disable formtabpagecontrol in COC of init and event handler of custom form.

(0) ShareShare
ReportReport
Posted on by

Hello all,

Happy new year! 

I have a custom formtabpagecontrol added to oob  markuptable form and requirement is to disable the custom tabpagecontrol  based on certain conditions.

Can you please share code or refer OOB code where this is happening and that can be used for reference.

Currently when trying to do COC as shared in code below, I am not sure what line to put to turn off/disable the code.

Also please share how to get this done using event handler.

[ExtensionOf(formstr(MarkupTable))]
final class myExtension
{
    public void init()
    {
        next init();
        if(markupModeul == MarkupModeType::Vend)
        {
          //Pls suggest  what to write to disable myTabPageCtrl disable here which has autodeclartion as Yes.
         }
    }
}
    }

Thanks

Mav

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,640 Most Valuable Professional on at
    RE: How to disable formtabpagecontrol in COC of init and event handler of custom form.

    Have you tried simply myTabPageCtrl.enabled(false)?

  • Mav Profile Picture
    on at
    RE: How to disable formtabpagecontrol in COC of init and event handler of custom form.

    Ahhh, did not used that, as intellisense  was not autotyping myTabPageCtrl.enabled, however forced typed it  now and voila it resolved the issue at COC level , thank you so much.

    Can you share the suggestion for event handler.

  • Martin Dráb Profile Picture
    237,640 Most Valuable Professional on at
    RE: How to disable formtabpagecontrol in COC of init and event handler of custom form.

    In an event handler, you can do something like this:

    FormRun formRun = sender;
    formRun.design().controlName(formControlStr(MarkupTable, MyTabPageCtrl)).visible(false);

  • Mav Profile Picture
    on at
    RE: How to disable formtabpagecontrol in COC of init and event handler of custom form.

    Hi,

    Can you please share how do I get module information at event handler , like if module = moduletype::cust (this moduletype is readily available in COC but need to get this at event handler.

    Thanks

    Mav

  • Martin Dráb Profile Picture
    237,640 Most Valuable Professional on at
    RE: How to disable formtabpagecontrol in COC of init and event handler of custom form.

    I would use CoC, because - as you see - it's easier to write and read. If you reject the easier way for some reason, be prepared for extra effort on your side.

    I guess you made a mistake and you actually mean 'markupModule', which is a form-level variable. Try accessing it by name: formRun.markupModule. I guess it won't work (but who knows), and you'll need to add an accessor method via CoC and call this method from your event handler.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 758 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 402 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans