Skip to main content

Notifications

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

  • Martin Dráb Profile Picture
    Martin Dráb 230,853 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.

  • Mav Profile Picture
    Mav 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
    Martin Dráb 230,853 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
    Mav 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.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,853 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)?

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…

Vahid Ghafarpour – Community Spotlight

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

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans