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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Call Form method from Button Clicked / "The class FormRun does not contain this method"

(0) ShareShare
ReportReport
Posted on by

Hi folks, hope ye are well.

I have read quite a bit on this topic but am failing to succeed.

I have a button under ActionPane/ActionPaneTab/ButtonGroup/myButton

the button has method 'clicked'.

Once clicked I wish to call a method on the Form, myMethod.

In the clicked method i have:

void clicked()
{
    FormRun myForm = element.args().caller();
    myForm.myMethod();
    super();
}


the myMethod() method displayed for me when I hit '.' and I can select it.

On compile it status the "The class FormRun does not contain this method"

Am just a little confused as to why this is not working for me as it seems quiet straight forward.

Any suggestions welcome.

rgds,

K.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    XB Profile Picture
    1,875 on at

    Are you on the same form where the method exists?

    so you can call him with reserve word element.

    element.mymethod

    think about formRun is a generic class object and only have default methods.

    if you want to call a method form other forms do something like this.

    in your destiny form

    init:
    this.parmCallerObject(element.args().caller());


    public Object parmCallerObject(Object _callerObject = callerObject)
    {
    if (!prmisDefault(_callerObject))
    {
    callerObject = _callerObject;
    }

    return callerObject;
    }

    //in your destinty form create a method to call method from orig form

    private void callOrigMethod()
    {

    if (formHasMethod(callerObject.owner(), "methodNamefromorigform"))
    {

    }
    }

  • Suggested answer
    Denis Macchinetti Profile Picture
    16,444 on at

    Hi

    If the method coming from the Caller form, you have to declare myform as Object, so:

    Object myForm = element.args().caller();

    myForm.myMethod();

  • Denis Macchinetti Profile Picture
    16,444 on at

    Again, you can use the global formHasMethod method in order to test if the method exist.

  • Community Member Profile Picture
    on at

    thank you both.

    yes, by button is on the main simple list form, and my method is under the form.

    element.myMethod() is exactly what i was looking for.

    thanks again.

    Rgds,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans