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 :
Microsoft Dynamics AX (Archived)

Get form menu item control when have form name, menu item type and menu item name using X++

(0) ShareShare
ReportReport
Posted on by 130

Hello everyone,

I am working with forms and menu item buttons and I have an issue with menu item buttons. 

I want to ask is there a way to get form control if we only have form name and menu item name of that control?

I used this:

Form form = new Form('PurchTableListPage');
FormFunctionButtonControl formControl;
str txt;
;
formControl = form.design().control(menuitemDisplayStr('LedgerTransVoucher1'));

if (formControl)
{
txt = formControl.name();

info(Txt);
}

But i dont have the name so it isn't worked.

Any ideas?

Thank you.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Get form menu item control when have form name, menu item type and menu item name using X++

    Menu item name does not make any sense.

    You need to know the form control by its' AOT name. If you have that, you could do

    form.formRun().control(form.formRun().controlid('YourControlNameInAOT'));

    Take a look at this as well:

    http://stackoverflow.com/questions/6937986/how-to-get-the-form-object-in-a-listpageinteraction-class

    If you do not know the form control's name like FormTabControl, then you could just iterate all form controls (see an example in SysWizard.prompt() method), and check the type of the formcontrol against their control types with the "is" keyword.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans